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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
yousrarami96
Partner - Contributor III
Partner - Contributor III

Display the minimum value based on a filter condition

Hello,

I have a table with PDL_Ref, PDS_Ref, PDS_Start_Date and I use a filter date to display all references whose PDS_Start_Date is between the start of the year and the selected date. Moreover, since one PDL_Ref can be associated to multiple PDS_Ref, and therefore have different PDS_Start_Date, I have to display only the PDS_Ref that has the minimum value of PDS_Start_Date.

I tried doing so using this formula but it doesn't return values to rows where PDL_Ref has more than one PDS_Ref :

if(PDS_Start_Date=aggr(min({<PDS_Start_Date={">=$(=yearStart(Date(vDate)))<=$(=Date(vDate))"}>} PDS_Start_Date),PDL_REFE),PDS_Start_Date)

In the example below, if I filter on vDate=31/12/2022, I should display only the second and third row 

PDL_Ref PDS_Ref PDL_Start_Date
AA220 A145 12/12/2022
AA220 A450 01/05/2022
AB471 B800 04/07/2022
Labels (2)
2 Replies
Chanty4u
MVP
MVP

Try this 

=FirstSortedValue({<PDS_Start_Date={">=$(=yearStart(Date(vDate)))<=$(=Date(vDate))"}>} PDS_Ref, PDS_Start_Date)

 

yousrarami96
Partner - Contributor III
Partner - Contributor III
Author

Hello @Chanty4u ,

Thank you for your response but it's not working correctly with the date filter applied. Plus, this would create a measure result of PDS_Ref and I would like to have the output as a dimension not a measure 😞