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

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
ineedhelp
Contributor III
Contributor III

Display most recent value based on date selection of date picker

I have this dataset, in this example, when I choose the range of date picker on qlik sense from '27-Oct-24' to '2-Nov-24', what I need is to display the latest value of column population_m, which is '781'. I tried to sum max date but it sum all the value from '27-Oct-24' to '2-Nov-24'

Here is the data set

Area Type flock current_state date_calc age_D age_W mortality_F mortality_M population_f population_m
L4 MI A Growing 27-Oct-24 28 5 1 0 1,154 783
L4 MI A Growing 28-Oct-24 29 5 0 1 1,154 782
L4 MI A Growing 29-Oct-24 30 5 0 0 1,154 782
L4 MI A Growing 30-Oct-24 31 5 1 0 1,153 782
L4 MI A Growing 31-Oct-24 32 5 0 0 1,153 782
L4 MI A Growing 1-Nov-24 33 5 1 0 1,152 782
L4 MI A Growing 2-Nov-24 34 5 0 1 1,152 781

 

Labels (3)
1 Solution

Accepted Solutions
rubenmarin
MVP
MVP

Hi, you can use FirstSortedValue(population_m,-date_calc)

Max should work also: Only({<date_calc={"=Date(Max(date_calc),'D-MMM-YY')"}>} population_m)

View solution in original post

4 Replies
Vegar
MVP
MVP

Sum ({< date_calc = {'$(=date(maxstring(date_calc))'} >}population_m)

(I am assuming your date_calc is a field and that it is a date value and not only a string. )

rubenmarin
MVP
MVP

Hi, you can use FirstSortedValue(population_m,-date_calc)

Max should work also: Only({<date_calc={"=Date(Max(date_calc),'D-MMM-YY')"}>} population_m)

ineedhelp
Contributor III
Contributor III
Author

The FirstSortedValue(population_m,-date_calc) work, somehow max is not work as I expected, thank you

Sunilsahu_345
Contributor III
Contributor III

Thanks everyone. FirstSortedValue(population_m,-date_calc) solved the issue perfectly for my date picker selection.

I also realized the reason the Max() approach was not behaving as expected was related to date formatting/evaluation in my set analysis expression. The FirstSortedValue() method feels cleaner and more reliable for returning the latest record value directly.