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: 
Not applicable

Set Analysis excluding all but one field

Hi, I want to use set analysis to calculate one value regardless of any current selection except one field

I have an expression:

=count({1}[Application Id for Counters]) - counts all ids disregarding current selection correctly.

I need to make sure that the only one field [Application Type] influences this count

Thanks

12 Replies
Not applicable
Author

I do not see how I can get '*' , from the expression you gave. the Char(42) does not have quotes around it. Do I need them?

='$(=if(GetSelectedCount([Application Type])>0, GetFieldSelections([Application Type], Chr(39) & ',' & Chr(39)), Chr(42)))'

I am having some trouble evaluating $ expression in the chart header. Do I use only

='$(=if(GetSelectedCount([Application Type])>0, GetFieldSelections([Application Type], Chr(39) & ',' & Chr(39)), Chr(42)))'

in the header chart and no dimension and no expressions?

If I do that I see * without quotes



johnw
Champion III
Champion III

No, you don't need to add quotes around chr(42). When he says to "Put the expression into a table chart, but don't give it a label", what he means by "the expression" is the expression he gave you, not some portion of the expression. The whole thing. If you do that (see attached), you will see what he shows you when there's no application type selected, including the single quotes. There ARE single quotes in the expression he gave you. They are outside of the dollar sign expansion, '$(=...)'. If you're not getting single quotes, then you probably copied his expression wrong.

If you play with the attached example, you'll see that NMiller's expression (on the top) is returning the right data, or at least the right data as best I understand your requirement. Since it's the only thing in the chart and there's no label, you can also see how it responds to selections of Application Type. If there are any selected, it lists them. If there are none selected, it uses '*'. Either way, it gives the right count.

The expression I provided is second. If you play with the selections, you can see that it does ignore "Other Field" in the sense that if an Application Type is allowed, it counts all records, not just records that match "Other Field". However, it fails in that if an application type is completely disallowed by the other field selection, its records will NOT be counted. This may still match some people's requirements, but seems less likely to than NMiller's expression.

The third chart shows a third possibility. I think this one will be slightly more efficient when nothing is selected. Rather than reducing to searching for '*', it actually removes that part of the set analysis completely. I doubt any performance difference would be noticeable in practice, though.

And hopefully this discussion also makes it clear why it's so helpful to post an example application with questions like this. There's no reason that we should be having this sort of back and forth discussion about what is and isn't right. There's no reason we should be trying to debug your code without even being able to see your code. We should all be looking at the same application, and it should be obvious whether it's right or wrong.

Not applicable
Author

thank you