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: 
anat
Master
Master

Top 5 records group by 2 dims in stright table and bar chart

Hi , below is my source data:

 

YearLocSales
2015a100
2015b250
2015c50
2016a250
2016b200
2016c350
2016d10
2017a300
2017b100
2017c400

need to display output stright table:

 

YearLocSales
2017c400
2017a300
2016c350
2016a250
2015b

250

same output in bar chart also please find the attachment required format.

Requirement is :Year & Loc are dimensions and expressions is :sum(Sales)

i have to display top 5 Loc records based on sum(Sales) and then order by Year

i have tried all the possible ways like order by sum(sales) desc and dimension limit but no luck.

8 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this expression.

Sum ({<Sales = {'=Rank(Sum(Sales),0,4)<=5'}>}Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
shiveshsingh
Master
Master

Hi Kaushal

Can you please explain this set expression?

kakani87
Specialist
Specialist

Top5.png

kakani87
Specialist
Specialist

Check this as Koushik suggested

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

It says that give the sum of Sales where the rank of the sales if below 5.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
shiveshsingh
Master
Master

Rank(0,4) what this means?

I am bit confused in rank function

kakani87
Specialist
Specialist

Hi Kaushik ... as Shivesh asked what this Rank(0,4) indicates

Because the below expression as well giving the same output with out 0,4

Sum ({<Sales = {'=Rank(Sum(Sales))<=5'}>}Sales)

anat
Master
Master
Author

hi Kaushik, thanks for support,for single expression its working fine,suppose if i use 2 expressions then i am not getting proper output.can u please check by adding dummy expression in chart level.PFA....