Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Standard Deviation (With Set Analysis)

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

DurationFlag
1151
2101
3121
420
530
690
7 Replies
Not applicable

Re: Standard Deviation (With Set Analysis)

Hi Jeremy.

You may try this:

sqrt((pow(Duration-avg({<Flag={1}>}Duration),2))/(Count({<Flag={1}>}Duration)))

Hope it works

Regards

Eduardo.

Employee
Employee

Re: Standard Deviation (With Set Analysis)

use stddev({<Flag={"1"}>}Duration)

Not applicable

Re: Standard Deviation (With Set Analysis)

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?

Employee
Employee

Re: Standard Deviation (With Set Analysis)

Can you set your expression to a variable? If yes, you can use a variable into Set Analysis

stddev({$<Flag={"$(variable)"}>}Duration)

Not applicable

Re: Standard Deviation (With Set Analysis)

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?

Employee
Employee

Re: Standard Deviation (With Set Analysis)

Sorry, I really misunderstand you.

Could you give us more detail? What kind of expression is Flag?

Not applicable

Re: Standard Deviation (With Set Analysis)

Thanks for the suggestions!

Community Browser