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: 
Syahfira1
Contributor III
Contributor III

Show top n and the sum of top n

Hi,

I would like to show top 10 , top 20 , top 30 of country based on sum of sales.

When I select top 10 , the chart should display me the top 10 countries and the total sales of that top 10 countries.

I have achieved part of what I want except showing the summation of the sales based on selected top n's. I would not able to show it when i use the table chart is because

1. The top is measured based on first column measure. 
2. It shows me the overall summation of sales regardless of the nth top selection.

Syahfira_Zakaria_0-1661667108653.png

Image above is what I have done so far. It shows me the top 10 of Past Due Cut of 30/06/2022 because its my first measure column.  Also, it shows me the totals amount for all countries but not for the top 10 only. 680 million is the total for all country not for the 10 countries

By default, Qlik will calculate based on the first measure column for top/bottom fixed number. Refer to image below 

Syahfira_Zakaria_1-1661667270658.png

 

This is my current formula

Syahfira_Zakaria_2-1661667574465.png

sum({<[Reporting Date.MasterCalendar.Date] = {"$(=vLatestDate)"}>}"Past Due")
-
sum({<[Reporting Date.MasterCalendar.Date]={"$(=date(addmonths(vLatestDate,-1)))"}>}"Past Due")

 

I want the table chart to show me the top 10 based on the MoM variation and Totals of the top 10 .

How I can make this work?

Your help is much appreciated.

 

 

 

Labels (1)
1 Solution

Accepted Solutions
Syahfira1
Contributor III
Contributor III
Author

Hi, managed to get the formula for top 10 

sum({$<[Dimension]={"=rank(sum([measure]),4,1) <= 10"}>} [measure])

View solution in original post

1 Reply
Syahfira1
Contributor III
Contributor III
Author

Hi, managed to get the formula for top 10 

sum({$<[Dimension]={"=rank(sum([measure]),4,1) <= 10"}>} [measure])