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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
hjesch
Contributor
Contributor

How do sum over the top 5 products for each customer with a filter?

I have a table with four columns: Customer, Product, Revenue, Date. I want to create a table with Customer as dimension, and the sum over the top 5 Product of Revenue, filtered on particular dates. I have tried to do this in set analysis:

SUM({<Product={"=RANK(SUM({<Date={somedate}>} Revenue))<=5"}>} Revenue),

but I think Qlik evaluates the Product-filter independent of the chart dimension, so it will only sum over the top 5 products overall, not per customer. How do I get the sum over the top 5 products for each customer?

Labels (6)
1 Solution

Accepted Solutions
PedroNetto
Partner - Creator
Partner - Creator

Hi @hjesch !

Try: AGGR(sum(Aggr(If(Rank( Sum( Revenue)) <= 5,Sum( Revenue)) , Costumer, Product)),Costumer)

 

 

View solution in original post

1 Reply
PedroNetto
Partner - Creator
Partner - Creator

Hi @hjesch !

Try: AGGR(sum(Aggr(If(Rank( Sum( Revenue)) <= 5,Sum( Revenue)) , Costumer, Product)),Costumer)