Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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)