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: 
katetsan
Creator
Creator

Get Max date and Max value with multiple dimension

Hi Communities,

I tried to use FirstSortedValue function to find the max date and max value correspondingly of multiple dimensions.

However, there're missing value in the result.

I'm wondering if there's another function could be applied for multiple dimensions(4 dimensions)?

************ Original Expression **************

Max Date: = Max(Date)

Max Value: = FirstSortedValue(Value, -(Date*10000+Value))

************ Original Expression **************

Thanks in advanced.

1 Solution

Accepted Solutions
sunny_talwar

What if you add DISTINCT here

FirstSortedValue(DISTINCT Value, -(Date*10000+Value))

View solution in original post

6 Replies
olivierrobin
Specialist III
Specialist III

hello

if you are in a chart, maybe you could use it in combination with aggr() function

sunny_talwar

What exactly are you looking to get? Max Value on the Max Date?

katetsan
Creator
Creator
Author

Hi Sunny,

Yes, I'm looking for max value on max date.

sunny_talwar

What if you add DISTINCT here

FirstSortedValue(DISTINCT Value, -(Date*10000+Value))

katetsan
Creator
Creator
Author

Hi Sunny,

It works perfectly.

May I ask why should we add distinct in the expression?

sunny_talwar

It might be possible that the Max(Value) on Max(Date) might repeat more than once... if that is the case, FirstSortedValue() needs DISTINCT to show the value... it's just how the function behaves.