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 Problem

Hi,

Just wondered if anyone could give me any quick pointers into some trouble I am having with a formula.

I tested the below in a text box, with a product (sku_id) selected and obtained the correct result.

=count({$<sku_id={"=rank(sum(purchase),sku_id)<=rec_count"},Association_type=-{''}>}sku_id)
/
Sum(rec_count)

However when I put the same formula into a table (Where sku_id is a dimension) it does not seem to work. Having played around and made changes it would appear that the problem lies with the “rec_count” contained within the Rank expression in the set analysis, it does not appear to work when in the table (I have substituted a number and got the correct result) so it would appear the value is not coming through?

rec_count is a data field containing a number (Linked 1:1 with sku_id) and is required for the calculation. (i.e for a given product the top x to include for the count can be different)

Any thoughts?

Thanks

2 Replies
Anonymous
Not applicable
Author

I know it is not very helpful, but anyway...

Set expressions are evaluated per overall data rather than per chart dimensions.  Hence, using expressions with set not always works as desired.  In your case, it make sense to try expression with "if".

Regards,

Michael

sushil353
Master II
Master II

Try to use TOTAL key word while calculating the rank ... or try to use first sorted value function either.

HTH

Sushil