Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlikuser09
Creator II
Creator II

Top 3 products and its top 3 customers in Multi KPI

I was able to get the top 3 product names displayed in KPI, but I want to display the top 3 customers(based on the count of the purchase date) for the top 3 products.


=FirstSortedValue([products],-aggr(count(sales date),[products]), 1)

How to add a sub field that displays the top customers for those products in KPI/Multi KPI

 

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Why don´t you try

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 1)

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 2)

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 3)

View solution in original post

6 Replies
stevejoyce
Specialist II
Specialist II

You can give below a try:

=concat(

 if(aggr( rank( count({<products= {"=aggr(rank(count([sales date]), 1, 1), products) <=3"} >} [sales date]), 1, 1), customers) <=3,
customers
), ', ')

Clever_Anjos
Employee
Employee

Why don´t you try

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 1)

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 2)

=FirstSortedValue([customers],-aggr(count(sales date),[customers]), 3)

Clever_Anjos
Employee
Employee

You would help other people when you close the threads you open marking the correct answer

https://community.qlik.com/t5/New-to-Qlik-Sense/automated-text-in-KPI-for-the-top-customer/m-p/18330...

Qlikuser09
Creator II
Creator II
Author

I want to get something like this, either in a separate KPI or single KPI

Top Product1   Top Product 2

Customer1      Customer1

Customer 2     Customer2

Customer3      Customer3

akmalquamri
Contributor III
Contributor III

Why we use -Aggr?

BrunPierre
Partner - Master
Partner - Master

Hi @akmalquamri, the negative sign is used to reverse the sorting order when using FirstSortedValue or similar functions to get the "first" value based on a specific expression.