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

How to find a variable based on max date and max sales (2 conditions) without any preloading

Hi all,

I have the table as follows:

datefruitsales
07-12-18papaya99
07-12-18apple926
07-12-18orange852
08-12-18papaya961
08-12-18apple252
08-12-18orange207
09-12-18papaya642
09-12-18apple452
10-12-18orange280
11-12-18papaya129
12-12-18apple751
12-12-18papaya301
12-12-18orange19

 

I would want the fruit name with the most sales for the latest date. In this case, 'apple' should be my answer.

 

Thanks!

Labels (4)
1 Solution

Accepted Solutions
OmarBenSalem

Create a KPI with this measure:

 

FirstSortedValue(fruit, -aggr( max ({<date={"$(=max(total date))"}>} sales),date))

 

Result:

Capture.PNG

View solution in original post

2 Replies
OmarBenSalem

Create a KPI with this measure:

 

FirstSortedValue(fruit, -aggr( max ({<date={"$(=max(total date))"}>} sales),date))

 

Result:

Capture.PNG

Anonymous
Not applicable
Author

Thanks Omar