I have a calculated table in which I'd like to filter out outliers greater than 3 standard deviations from the mean using SQL. The query is as follows:
- WITH data AS (
- SELECT
- cycle,
- (g_vi_e - g_vi_s)/60 AS cycletime
- FROM SC_18RdWSX
- GROUP BY 1
- ), data_with_stddev AS (
- SELECT
- cycle,
- cycletime,
- (cycletime - avg(cycletime) over ())
- / (stddev(cycletime) over ()) AS zscore
- FROM data
- ORDER BY 1
- )
- SELECT * FROM data_with_stddev WHERE abs(zscore) < 3
I'm getting an error in the System Console as follows,
- syntax error, unexpected identifier WITH, expecting end of code. Make sure commas, parentheses, etc. are placed correctly
Is the WITH clause permitted in FlexSim? If not, could anyone suggest a way to filter out outliers from Calculated Table results?