# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
New Contributor III

## 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.

Thanks

5 Replies
Contributor III

## Re: Top 3 countries and their sales in Text boxes

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,

MVP

## Re: Top 3 countries and their sales in Text boxes

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)

Valued Contributor II

## Re: Top 3 countries and their sales in Text boxes

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

Contributor III

## Re: Top 3 countries and their sales in Text boxes

Hi sunny stalwar1 ,

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

Regards,

MVP

## Re: Top 3 countries and their sales in Text boxes

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?