Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
LOAD * Inline [
Client , Tickets
A , 20
b , 20
C , 30
A , 20
D , 5
];
This return the highest number of tickets a client has
=Max(aggr(Sum(Tickets),Client))
Now how do I return the client name with the highest number of tickets in a textbox
Hi,
you can try this on a textbox:
=FirstSortedValue(Client,-Tickets)
I edited the inline table it so both A add up to 40 , instead your expression returns C , instead of A
because the values are not grouped in the back end, you need to group your measure by the Client dimension using Aggr()
like this:
=FirstSortedValue(Client,-aggr(sum(Tickets),Client))
Or this
Only({<Client = {"=Rank(Sum(Tickets)) = 1"}>}Client)
Hi Sunny,
I was thinking about this and try to use it, but didn't work, I think it need some grouping inside the Rank function..
Grouping inside rank? Don't we already have Sum() to group?
Yes, because here the Rank 1 you will find on A and C, so the expression will take which Client Value ?
I tried this and it worked:
=Only({<Client = {"=Rank(aggr(Sum(Tickets),Client,Tickets)) = 1"}>}Client)
But this didn't work?
Only({<Client = {"=Rank(Sum(Tickets)) = 1"}>}Client)
That is so strange... let me give it a shot