Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
james
Creator III
Creator III

Set Analysis

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?

5 Replies
Not applicable

Hi,

Do you want to use it in a Calculated Dimension?

eiconsulting
Partner - Creator II
Partner - Creator II

TRY ... Sum({$<Flag ={'1'}>}[Data Dump]) ???

Flavio

Federico Sason | Emanuele Briscolini
james
Creator III
Creator III
Author

I dotn want to use it in an expresion, just as a dimension.. so it only shows Dat Dump

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

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

johnw
Champion III
Champion III

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.