Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
thierrytt1102
Partner - Creator II
Partner - Creator II

top 3 departments in a sentence

Dear, 

I have a table like this

Department    |   sum(Sales)
A                          |    100
B                         |    200
C                         |    300
D                         |    800
E                         |    100
F                         |    1000

And I 'd like to group the 3 best departments in a sentence like: 

"Departments  F, D and C have the best score."

Could you help me in designing this formula? 

Thank you!!

 

Labels (3)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

One more correction is required. Try:

='Departments '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department))
& ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department),2 )
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department),3)& 'have the best score.'

 

 

View solution in original post

JordyWegman
Partner - Master
Partner - Master

Hi,

The commas with the numbers were wrong placed. Use this:

'Departments '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department))
& ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department),2 )
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department),3)& 'have the best score.'

Jordy

Climber 

Work smarter, not harder

View solution in original post

4 Replies
tresesco
MVP
MVP

Try like:

='Departments  '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department)
              & ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department, 2)  
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department, 3)& 'have the best score.' 

 

thierrytt1102
Partner - Creator II
Partner - Creator II
Author

Hi, 

Thx for your response, we're almost done...

when I'm creating an app with:

 

load* Inline [Department,Sales
A,100
B,200
C,300
D,800
E,100
F,1000];

I'm copy pasting your formula, correcting a little parenthesis error, I have the first value, but not the other..

Can you help me?

 

Formula: 

'Departments '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department))
& ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department, 2) )
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department, 3))& 'have the best score.'

 

tresesco
MVP
MVP

One more correction is required. Try:

='Departments '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department))
& ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department),2 )
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department),3)& 'have the best score.'

 

 

JordyWegman
Partner - Master
Partner - Master

Hi,

The commas with the numbers were wrong placed. Use this:

'Departments '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department))
& ' , ' & FirstSortedValue(Department, -Aggr(Sum(Sales), Department),2 )
& ' and '& FirstSortedValue(Department, -Aggr(Sum(Sales), Department),3)& 'have the best score.'

Jordy

Climber 

Work smarter, not harder