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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis and calculated dimension

Hi,

I'm looking at creating a calculated dimension with set analysis where the values of two fields are compared.

eg. origin = destination or same_origin_and_destination_flag = 1

currently, I use an 'If" statement but am wondering if this can be done using set analysis instead.

(There are approximately 2 million rows in the table that needs to be analysed and would like to compare which is a better option)

Any help with the syntax is appreciated.

1 Reply
johnw
Champion III
Champion III

It sounds like you're looking for the solution which lets the chart calculate the fastest? I wouldn't use a calculated dimension or set analysis then. Consider doing something like this in the script instead:

LOAD
ID
,origin
,destination
,if(origin=destination,ID) as ID_with_same_origin_and_destination
...

Then use the new ID field instead of the real ID field, and suppress nulls. I suspect that will be the fastest approach for the chart by a significant margin. Worth testing, in any case. Oh, and replace "ID" with whatever field you really wanted to play with if it isn't an ID. Same idea.