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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
mikecrengland
Creator III
Creator III

Set Analysis & intersection (*=)

Hello All -

I need some help understanding what I've done and hopefully some direction on a better way.

I have a straight table with a drill down group as the dimension. The fields in the drill down are Country - Segment - Business Name. (In our CRM, Segment is equivalent to Territory) I need to count the covered business and used:


= Count({<[Segment.Name] = {"**"}>} Distinct [Business.Key])


to count businesses with a Segment assigned. It works like a charm until I drill down to the actual segment. At that point, it doesn't filter to the actual segment. So, If I filter to Australia - 'Australia Segment 1', all of the Australia businesses are still returned in the table. (Instead of only Austrailia Segment 1, I get all segmented businesses in Australia)


If I change the expression to:


= Count({<[Segment.Name] *= {"**"}>} Distinct [Business.Key])


everything works as expected and I only get business from the segment that I've filtered to.


I guess my question is with the {"**"} ... I thought that meant count [Business.Key] if it has a segment. But I expected that it would still filter without the intersection set analysis. Any help would be much appreciated!


Mike

www.fortunecookiebi.com

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Mike,

The default behaviour with Set Analysis is that you provide a selection to override the selection that is made in the UI.  This can be really useful - but can lead to results that can be counter intuitive to users.  By using the intersection code (*=) you don't override the selections made by the user - you further limit what they have selected to what the Set Analysis dictates.  Generally this is a much better thing to be doing.

*= is a not particularly well documented feature of Set Analysis - but it is often the most useful way of doing things.  Unfortunately, syntax highlighting is not properly aware of the syntax - and often highlights expressions in red when you try to use it.

- Steve

View solution in original post

3 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Mike,

The default behaviour with Set Analysis is that you provide a selection to override the selection that is made in the UI.  This can be really useful - but can lead to results that can be counter intuitive to users.  By using the intersection code (*=) you don't override the selections made by the user - you further limit what they have selected to what the Set Analysis dictates.  Generally this is a much better thing to be doing.

*= is a not particularly well documented feature of Set Analysis - but it is often the most useful way of doing things.  Unfortunately, syntax highlighting is not properly aware of the syntax - and often highlights expressions in red when you try to use it.

- Steve

mikecrengland
Creator III
Creator III
Author

Thanks, Steve!

One more question around the {"**"} modifier... Is that the right way to do 'not null'?

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Mike,

It is indeed, except you should only need the one *.  If this is a field you use for selections a lot you might want to consider replacing the nulls out in the load script, eg:

if(isnull([Segment.Name]), 'No Segment', [Segment.Name]) as [Segment.Name],

That means you can code for it and select it (or exclude it) more easily.

Cheers,

Steve

http://www.quickintelligence.co.uk/