Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
JustinDallas
Specialist III
Specialist III

Show Lowest Salesperson By Amount Sum

Hello Folks,

I have some dummy data, and I'd like to show the name of the salesperson with the least amount of sales by sum.

Data:
Load * Inline
[
	SalesPerson, SaleId, Amount
    Ricky, 1, 256
    Ricky, 2, 765
    Ronnie, 3, 23
    Ronnie, 4, 67
    Ronnie, 5, 865
    Bobby, 6, 123
    Mike, 7, 879
    Mike, 8, 123
    Johnnie, 9, 256
	Johnnie, 10, 256    
]
;

Exit Script
;

 

I'm expecting something like the following:

Screenshot 2023-05-30 094531.png

 

At first, I thought I could use FirstSortedValue, but I can't seem to be able to figure it out.

 

Any help is greatly appreciated.

Labels (2)
2 Replies
BrunPierre
Partner - Master
Partner - Master

Hi, In the unlikely event that multiple sales persons have the same minimum amount, this will display them as well.

=Concat(Aggr(If(Rank(-Sum(Amount))=1, SalesPerson), SalesPerson),', ')

Kushal_Chawda

@JustinDallas  FirstSortedValue will be the right choice here

=FirstSortedValue(distinct SalesPerson, aggr(sum(Amount),SalesPerson))