# App Development

Announcements
Don't miss the upcoming Q&A with Qlik session on Qlik Application Automation on November 16th! REGISTER NOW
cancel
Showing results for
Did you mean:
Creator

## max value of max date

Hi everyone,

i want to get the max of the position of the max date value, i should use set analysis with firstsortedvalue, can any one help please? i have joined a capture as exemple of data, i want chose the max position of the max date of type 1:

this expression doesn't work:  max({<date={"\$(=firstsortedvalue({<type={1}>} date,-date))"}>} position)

desired lignes are colored with yellow:

Labels (1)
• ### Other

1 Solution

Accepted Solutions
MVP

Hi
Try like below

fund:
fund, date, position, type
F1, 01/01/2021, 10, 1
F1, 01/12/2021, 9, 1
F1, 01/12/2021, 5, 1
F2, 01/03/2020, 7, 1
F2, 01/03/2020, 18, 2
F2, 01/03/2020, 19, 1
];
Join
Load fund, max(date) as date, 1 as flag Resident fund where type = 1 Group by fund;

O/p:

Thanks & Regards,
Mayil Vahanan R
5 Replies
MVP

Hi
Try like below

fund:
fund, date, position, type
F1, 01/01/2021, 10, 1
F1, 01/12/2021, 9, 1
F1, 01/12/2021, 5, 1
F2, 01/03/2020, 7, 1
F2, 01/03/2020, 18, 2
F2, 01/03/2020, 19, 1
];
Join
Load fund, max(date) as date, 1 as flag Resident fund where type = 1 Group by fund;

O/p:

Thanks & Regards,
Mayil Vahanan R
MVP

You actually need a simpler expression for this: 😊

firstsortedvalue({<type={1}>} position,-date)

Creator
Author

Hi @tresesco ,

thank you for the answer, however the formula doesn't work, i have a complicated set analysis in a star schema, the picture above is just for explaning the need, also i need the max position of the max date.

Creator
Author

Hello @MayilVahanan ,

is there any way to achieve this without touch to the dataset, we have some requirements so we should have simple selects in load script (avoiding joins),

MVP

Might be, try like below

If(date = Max(Total<fund> date), max({<type={1}>}position))

Thanks & Regards,
Mayil Vahanan R
Tags
Community Browser