Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
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.

1 Solution

Accepted Solutions
Kushal_Chawda

FirstSortedValue(Distinct Dimension, Expression)

View solution in original post

4 Replies
sunny_talwar

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

FirstSortedValue(Distinct Dimension, Expression)

Clever_Anjos
Employee
Employee

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.