Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Max Date should not be greater than Today

Hi

I want to create a variable where the max date should not be greater than today.  Currently I have a max date as 31 Dec 2017.

Formula for Max Date:

=Date(max(Date),'YYYY/MM/DD')

Here is my variable.

=if(num(max(Date))>num(Today()), Null(),Date)


I can't seem to get it right.


Thank you


Kind regards

Nayan

1 Solution

Accepted Solutions
Kushal_Chawda

=if(floor(max(Date))>floor(today()), floor(today()),max(Date))


or



=if(floor(max(Date))>floor(today()), null(),max(Date))

View solution in original post

9 Replies
Anil_Babu_Samineni

Let's assume, your variable looks like below, You may don't have issue with Date formats

LET Var = Date(Max(Date),'YYYY/MM/DD')

And then condition should be like this

If($(Var) > Date(Today(), 'YYYY/MM/DD'), Null(), Date)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

If you are expecting the variable to return the max date, try like:

=if(max(Date)>Today(), Null(),Date(Max(Date)))

Or, simpler

=if(max(Date)<=Today(),Date(Max(Date)))

Kushal_Chawda

=if(floor(max(Date))>floor(today()), floor(today()),max(Date))


or



=if(floor(max(Date))>floor(today()), null(),max(Date))

Anonymous
Not applicable
Author

Hi Anil

Thank you for your response.  Will try it out and let you know.

Kind regards

Nayan

Anonymous
Not applicable
Author

Hi Anil

I've tried your formula, however i still get a blank.

VCurrentDate.JPG

kind regards

Nayan

Kushal_Chawda

have you tried my solution?

jmvilaplanap
Specialist
Specialist

You can use the RangeMin function, this will return the minimum value, for example

=RangeMin(max(Date), Today())

Anil_Babu_Samineni

You mean to say, Are you trying this expression in Variable?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
antoniotiman
Master III
Master III

Hi,

try

=Max({<DateField={'<=$(=Date(Today()))'}>} DateField)

Regards,

Antonio