Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
drohm002
Creator
Creator

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
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.