Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Please help!
I have the following data set:
I am looking calculate the standard deviation on just the cases where the flag is 1 through set analysis:
Any assistance would be appreciated,
Thanks
Case | Duration | Flag |
---|---|---|
1 | 15 | 1 |
2 | 10 | 1 |
3 | 12 | 1 |
4 | 2 | 0 |
5 | 3 | 0 |
6 | 9 | 0 |
Hi Jeremy.
You may try this:
sqrt((pow(Duration-avg({<Flag={1}>}Duration),2))/(Count({<Flag={1}>}Duration)))
Hope it works
Regards
Eduardo.
use stddev({<Flag={"1"}>}Duration)
This works for me. However, I have a similar case where flag is an expression, not a field. It is a somewhat complicated expression, including user input from several input boxes (so I cannot add it to the LOAD statement).
In that case, stddev({$<Flag={"1"}>}Duration) does not work. I guess this is because an expression can't be used in Set Analysis? Any suggestions for this?
Can you set your expression to a variable? If yes, you can use a variable into Set Analysis
stddev({$<Flag={"$(variable)"}>}Duration)
I think perhaps I am not following. In fact, my column "Flag" is an expression. I need to find the stddev(Duration) of all rows where Flag = 1.
The problem is that Flag is an expression that uses user inputs (basically an adjustable filter), and set analysis does not seem to work that way. Does that make sense? Am I missing something?
Sorry, I really misunderstand you.
Could you give us more detail? What kind of expression is Flag?
Thanks for the suggestions!