Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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]))

19 Replies
Anonymous
Not applicable
Author

How does this work? if A=1 and B=1?  1 Being "1" not 0.9178181 or 1.00000002525, Would the two 1's not keep going in parallel meaning they will always be the same?

sunny_talwar

Name itself will be ranked differently. For example

B = 1

A = 2

Anonymous
Not applicable
Author

So if we have two John Smith's both with number 1, we are screwed?  so it's fair to say this isn't 100% bulletproof?  Don't get me wrong, I'm happy with the result, but I should be aware it's not 100% or is it?

sunny_talwar

Here is your bullet proof

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

or

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

Since the name is the same, doesn't matter which John Smith shows up, right

sunny_talwar

Or use Employee ID to differentiate between John Smiths

Anonymous
Not applicable
Author

Hope I didn't offend you by saying bulletproof, but I'm sure you know where i'm coming from.

Anonymous
Not applicable
Author

It's easier to read names to ID numbers when you got 5k employees.

sunny_talwar

I absolutely don't feel offended... I am glad you are thinking above and beyond.... I absolutely absolutely encourage you to do that

UPDATE: Made sure the above statement read right

sunny_talwar

Agreed!! but use that for sorting

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

or

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

Anonymous
Not applicable
Author

I did and it works a treat.