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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

FirstSorted Value is Null

Sometimes this is a drawback for the FirstSortedValue function: "If more than one value of expression share the same lowest sort-order, the function will return null."

Even where an expression has a single repeated value, it can be useful to have this value returned as the first entry, instead on Null.

Any tips on a neat and easy way of doing this ?

Thanks.

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

FirstSortedValue(Distinct Dimension, Expression)

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

You can use DISTINCT within FirstSortedValue() to show one of them, but to see both you might need to use Aggr() function together with FirstSortedValue.

Kushal_Chawda
MVP
MVP

FirstSortedValue(Distinct Dimension, Expression)

Clever_Anjos
Support
Support

Two solutions

  • Use Distinct as previous answers
  • Use a second expression to untie the sorting eg: FirstSortedValue( Dimension, Expression + AnotherExpression/10000)
richard_chilvers
Specialist
Specialist
Author

Thanks.

I wasn't aware that DISTINCT could be used here - I was relying on interactive help which doesn't show it as an option.