Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last date before a certain date

Hi everyone.

I'm trying to create a expression where I show the last date associated with a product before the date selected.

For example, I want to see the last date associated with a product before 2012-12-31.

If Product A has 2012-10-10,2012-01-01,2013-04-04 dates associated with it, then the last date before 2012-12-31 is 2012-10-10.

Can anybody help me?

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

=max({1<[yourDate]={"<$(=max([yourDate]))"}>}[yourDate])

View solution in original post

4 Replies
Clever_Anjos
Employee
Employee

=max({1<[yourDate]={"<$(=max([yourDate]))"}>}[yourDate])

Not applicable
Author

Thank you so much for your answer. This is almost what I need.

I need to select the last date prior a selected date. This selected date will be stored in a variable so my expression will be something like

=date(max({1<P_DATE={"<$(=V_DATE)"}>} P_DATE))

But I can't seem to make this expression work with a variable.

Clever_Anjos
Employee
Employee

What didn´t worked?

Not applicable
Author

Never mind, I just managed to make it work. My variable V_DATE wasn't in the correct Date Format before but now it's fixed. Thank you for your help!