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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
drohm002
Creator II
Creator II

Last Month Flag for the current year

Hello, i have built a LastMonthFlag and it correctly grabs April, but i only want it to grab April of the current year.  How do i achieve this? It is currently grabbing April for every year in my dataset. My code is below.

IF(Month(datefield) = Month(now())-1,1,0) as LastMonthFlag

 

Please help me achieve this, thank you!

 

 

Labels (5)
1 Solution

Accepted Solutions
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

IF(MontStart(datefield) = MonthStart(now(),-1),1,0) as LastMonthFlag

 

cheers

cheers Lech, 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 to the problem.

View solution in original post

2 Replies
anat
Master
Master

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

IF(MontStart(datefield) = MonthStart(now(),-1),1,0) as LastMonthFlag

 

cheers

cheers Lech, 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 to the problem.