Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Luben
Creator
Creator

help with variable to reference previous day

Hi Qlik Community,

I'm currently working with a Qlik Sense script where I need to set a variable to reference the previous day based on the maximum date in my vDateField. My current script looks like this:

Set vDay = '"~(=Max($(vDateField)))"';
Let vDay = Replace([vDay],'~','$');

However, this script currently sets vDay to the maximum date in vDateField. I want to modify it so that vDay references the day prior to the maximum date instead of the maximum date itself.

Could someone help me with the correct approach to adjust this script so it references the previous day?

Thank you in advance for your assistance!

Labels (3)
2 Replies
TauseefKhan
Creator III
Creator III

Check with this:

For previous day based on the maximum date in your vDateField.

Set vDay = '$(=Date(Max($(vDateField)) - 1, 'YYYY-MM-DD'))';

anat
Master
Master

=date($(vDateField)-1)