Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
smiling_cheetah
Creator
Creator

Using set analysis (?) to keep records only => than aggr (?) in chart

Good day dear community,

I came across the following task:

Calculate sum(value) but only for those buyers, which have no less that 5 transactions.

Let's say I have a model with these two tables:

Trans:

trans_idbuyer_idtrans_value
1A10
2A20
3B30

buyer_idbuyer_name
AAlpha
BBravo

Then I visualize it in a bar chart:

Dimension: buyer_name

Measure: sum(trans_value)

I've achieved the desired result with IF: if(count(trans_id)>=5, sum(trans_value))

But wonder is there a more elegant/efficient way to do the same with set analysis?

Would appreciate any help, thanks

1 Solution

Accepted Solutions
arulsettu
Master III
Master III

maybe like this

sum({<trans_id={"=count(trans_id)>=5"}>}trans_value)

View solution in original post

2 Replies
arulsettu
Master III
Master III

maybe like this

sum({<trans_id={"=count(trans_id)>=5"}>}trans_value)

smiling_cheetah
Creator
Creator
Author

Oh, thank you, so there was no need for aggr function

Your script works fine when trans_id is replaced with buyer_name:

sum({<buyer_name={"=count(trans_id)>=5"}>}trans_value)