Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

FirstSortedValue Not showing First "TOP USER" in textbox

Hi Guys,

FirstSortedValue Not showing First "TOP USER" in textbox when two users have the same value.  For example if Tom has 10 sessions and Harry has 9, my top user will display Tom, which is correct.  If Tom and Harry both have 10, it doesn't show no one.

I've come across this before but it will take the first sorted by alphabet, how can i sort this out to only show one user?

Regards

='TOP USER: ' & FirstSortedValue([Name], -aggr(count( Session), [Name]))

1 Solution

Accepted Solutions
sunny_talwar

Apologizes, I forgot to add closing parenthesis for Rank function

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) + Rank([Name])/1E10, [Name]))

or

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) - Rank([Name])/1E10, [Name]))

View solution in original post

19 Replies
sunny_talwar

May be this:

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) + Rank([Name])/1E10, [Name]))

not sure if it needs to be + or -, try both

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) - Rank([Name])/1E10, [Name]))

Anonymous
Not applicable
Author

That's giving me an error in the expression

vinieme12
Champion III
Champion III

it may be because you have more than one customer with the same weight / rank , FirstSortedvalue will return null in that case

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

I know that bit, I'm trying to resolve how to sort it, possibly by sorting by alphabet.

sunny_talwar

Apologizes, I forgot to add closing parenthesis for Rank function

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) + Rank([Name])/1E10, [Name]))

or

='TOP USER: ' & FirstSortedValue([Name], -aggr(Count( Session) - Rank([Name])/1E10, [Name]))

Anonymous
Not applicable
Author

Thanks Sunny T, yet again

Happy New Year Guys

sunny_talwar

Happy New Year!!

trdandamudi
Master II
Master II

Sunny,

You are dividing  Rank([Name]) / 1E10 and what does 1E10 refers to ?

Thanks

sunny_talwar

1E10 = 1/10,000,000,000 (1 divided by 10,000,000,000)