Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Naushad07
Contributor III
Contributor III

First Sorted Value not working

Hi All,

I have a table and I want to find out which browser has maximum views.

Ex:

Browser Type         Views

Chrome                        100

Mozilla                             50

IE                                        20

 

I'm using this formula to find: FirstSortedValue([Browser Type],-Aggr(Sum(Views),[Browser Type]),[Browser Type])

This formula is not working for some reason as KPI(working if used it in a table). However, if I remove the minus(-) sign, I'm getting IE as value.

I'm confused as to why this is not working. Please help.

Also, is there any alternative formula to use?

 

Labels (5)
5 Replies
Taoufiq_Zarra

try this :

=FirstSortedValue([Browser Type],-Aggr(Max(Views),[Browser Type]))
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
lorenzoconforti
Specialist II
Specialist II

It looks like you have an extra argument you shouldn't have; the third (optional) argument in FirstSortedValue is the rank but you're passing "[Browser Type]" which is not a number. 

Try this:

FirstSortedValue([Browser Type],-Aggr(Sum(Views),[Browser Type]))

Naushad07
Contributor III
Contributor III
Author

It did not work.

Same as before this is working without the minus(-) sign. I guess I need to know how to bring in the last value(rank) in the 3rd Argument. 

Kushal_Chawda

Ideally below expression should work as expected

=FirstSortedValue([Browser Type],- Aggr(sum(Views),[Browser Type]))

But, You can try below as well.

1) =Only({<[Browser Type]={"=rank(sum(Views),0,4)=1"}>}[Browser Type]) 

2) = aggr(if(max( total aggr(sum(Views),[Browser Type]))=sum(Views),[Browser Type]),[Browser Type])

Note: Try to use set analysis expression first instead if.

sunny_talwar

Do you have multiple Browsers where Views have the same max value? If that is the case, then which one would you want to see? All of them or randomly one?

For Randomly one, try this

FirstSortedValue(DISTINCT [Browser Type], -Aggr(Sum(Views), [Browser Type]))

For displaying multiple values separated by comma

Concat(Aggr(If(Sum(Views) = Max(TOTAL Aggr(Sum(Views), [Browser Type]), [Browser Type]), [Browser Type]), ', ')