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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Fig1
Contributor III
Contributor III

Formula for previous 2 months from 1st of month from getdate

Hi there

I have this formula in my load script which brings through all data up to the end of the previous month.

Dischargedate < DATEFROMPARTS(YEAR(GETDATE()),MONTH(GETDATE()),1)

In my dashboard I need to show a section of data where we are comparing the last two months. 

I'm trying to create a formula where the discharge date is greater than the month(getdate()),1) minus two months.

I need a formula similar to this one but instead of todays date i need it to show two months prior from the end of month (month(getdate()),1))

=if(DischargeDate > add months(today(), -2),1,0) as FlagTwoMonths

Any suggestions welcome 🙂

 

Labels (1)
1 Solution

Accepted Solutions
Muthukumar_77
Contributor III
Contributor III

Hi,

=if(DischargeDate > AddMonths(MakeDate(Year(Today()),Month(Today()),01),-2),01) ,1,0) as FlagTwoMonths

Thanks Regards,
Muthukumar P
Qlik Developer

View solution in original post

2 Replies
Muthukumar_77
Contributor III
Contributor III

Hi,

=if(DischargeDate > AddMonths(MakeDate(Year(Today()),Month(Today()),01),-2),01) ,1,0) as FlagTwoMonths

Thanks Regards,
Muthukumar P
Qlik Developer
Fig1
Contributor III
Contributor III
Author

This worked perfectly.

Thank you!