Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I know this is ismple, yet my brain is fried.
I was using
if(Flag = '1',[Data Dump] for a dimesnion
How can I use set analysis to do this?
Hi,
Do you want to use it in a Calculated Dimension?
TRY ... Sum({$<Flag ={'1'}>}[Data Dump]) ???
Flavio
I dotn want to use it in an expresion, just as a dimension.. so it only shows Dat Dump
James,
you can't use Set Analysis directly in the calculated dimension. You can, however, replace the need in a calculated dimension, by using Set Analysis in the expression.
Let me expand your example a bit. Suppose you have a calculated dimension and an Expression:
Dimension = if(Flag = '1',[Data Dump])
Expression = sum(Amount)
As an alternative, you can avoid a calculated dimension and move the condition into the expression:
Dimension = [Data Dump]
Expression = sum({< Flag = {1} >} Amount)
The result will be the same, only the second solution might work faster on a large data set.
Cheers,
Oleg
I'm guessing that set analysis won't work faster and will only add maintenance complexity if you have multiple expressions. The idea is that when faced with a calculated dimension, QlikView would be wise to first figure out the dimension values, and then treat that LIKE a set for retrieving the data. So I would expect it to internally use mostly the same code and be just as fast either way. I could, of course, be completely wrong about QlikView's internals, but only testing on your own data set would tell you which is faster.
As yet another alternative, you could make a new field, "Flagged Data Dump", and set its value to "Data Dump" when the flag is set, and null otherwise. Then your chart maintenance is as simple as can be, with "Flagged Data Dump" as the dimension and sum(Amount) as the expression.
I've used all three approaches, and all three work fine. I haven't developed a standard for my own development, which is bad, since consistency would be nice.