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: 
kamal_sanguri
Specialist
Specialist

Problem with set analysis

I am not able to figure out the problem with this Set Expression:

=count({<Author_Name = {"=rank(count({<Word_Count = {'>250'}>}Stories))<=5"}>}Stories)

I have written it to count the number of stories where Word_Count is over 250 with top 5 authors... This expression returns the number but not correct.. it is ignoring condition to check word_count > 250. Even if I change 250 to 100 there is no difference.

21 Replies
vishsaggi
Champion III
Champion III

Absolutely.

kamal_sanguri
Specialist
Specialist
Author

Hi Sunny, hope u are well.. sorry for the confusion (<5 or <=5). However the issue still persists:

=Count({<Author_Name = {"=rank(count({<Word_Count = {[>250]}>}Stories))<5"}>}Stories)

Even with the your expression, it is ignoring Word_Count filter. Even if I make it 100 or any other number.. expression gives the same result.

kamal_sanguri
Specialist
Specialist
Author

I tried all these variants :

=count({<Author_Name = {'=rank(count({<Word_Count = {">250"}>}Stories))<=5'}>}Stories)

=count({<Author_Name = {"=rank(count({<Word_Count = {'>250'}>}Stories))<=5 "}>}Stories)

=Count({<Author_Name = {"=rank(count({<Word_Count = {[>250]}>}Stories))<=5"}>}Stories)

=count({<Author_Name = {"=rank(count({<Word_Count = {"">250""}>}Stories))<=5"}>}Stories)

they all give same result..

kamal_sanguri
Specialist
Specialist
Author

Capture.PNG

22469+20744+20659+14480+10416 = 88768 this is the number that I am getting with all the above mentioned expression.

Capture.PNG

17202+15977+15849+11071+8090=68189. This is the number which I am expecting.. with filter of word count more than 250.

Digvijay_Singh

You may try this as well -

=count({<Author_Name = {"=rank(Aggr(count({<Word_Count = {'>250'} >}Stories),Author_Name))< 5 "}>} Stories)

kamal_sanguri
Specialist
Specialist
Author

Thanks but same result.. as if it is ignoring or not understanding Word_Count<250

kamal_sanguri
Specialist
Specialist
Author

same story, even if you make 250 as 100 you get same result.

Digvijay_Singh

See if this makes any difference or else share the sample data to try further -

=count({<Author_Name= {"=rank(count({<Word_Count = {[>250]} >}Stories))< 5"},Word_Count = {">250"}>} Stories)

kamal_sanguri
Specialist
Specialist
Author

stalwar1swuehl


I have get it working using expression

if(rank(sum(if(Word_Count>250,1)))<=5,sum(if(Word_Count>250,1)))


but still not able to understand why the set expression not working.. if you could spend few moments to review it again.

Regards,

-Kamal

kamal_sanguri
Specialist
Specialist
Author

yeah that worked, I see you intelligently used an additional filter to filter the data set.