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: 
vishalmanu
Partner - Creator
Partner - Creator

Top 3 countries and their sales in Text boxes

HI,

I have a table with countries and sales. No i have to display the top 3 countries in three different text boxes and their sales in the another three text boxes respectively.

Please suggest.

Thanks

5 Replies
pathiqvd
Creator III
Creator III

Hi Vishnu,

Try like this,

For 1 st Rank in 1st text object:-

=Only(if(aggr(rank(sum(Sales)),Country)=1,Country))&'--'&sum({<Country={"=rank(Sum(Sales))=1"}>}Sales)

For 2 st Rank in 2st text object:-

=Only(if(aggr(rank(sum(Sales)),Country)=2,Country))&'--'&sum({<Country={"=rank(Sum(Sales))=2"}>}Sales)

.....Etc, Like rtry

Regards,

sunny_talwar

May be this

=FirstSortedValue(DISTINCT Country, -Aggr(Sum(Sales), Country), 1) & Chr(10) &

Max(Aggr(Sum(Sales), Country), 1)

=FirstSortedValue(DISTINCT Country, -Aggr(Sum(Sales), Country), 2) & Chr(10) &

Max(Aggr(Sum(Sales), Country), 2)

=FirstSortedValue(DISTINCT Country, -Aggr(Sum(Sales), Country), 3) & Chr(10) &

Max(Aggr(Sum(Sales), Country), 3)

sergio0592
Specialist III
Specialist III

Hi, see the attached .qvw file. Hope it helps you.

pathiqvd
Creator III
Creator III

Hi sunny stalwar1 ,


       I have one doubt suppose this situation how we can solve?

rank isuu.JPG

Regards,

sunny_talwar

I guess it depends on what the output needs to look like? Would it be A & C or A or C as the top 1?