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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
stuwannop
Partner - Creator III
Partner - Creator III

Flag for Next Month/Year

Hi Everyone

I have a script line that will return a 1 or a 0 based on the date falling in the next month. The problem I have is when it gets to December, where the script below will return the year 2013 for todays date, not 2014.

I can see why it does it but I was wondering how I could get around it - I was thinking of putting in an IF statement (where if the month is 12 then +1 to the year) - but is there a smarter way of doing it? Thanks for any help!

( Month(Addmonths(Today(),1)) =Month([Promised Payment Date])   AND Year(Today())= Year([Promised Payment Date]), 1, 0)

Labels (1)
4 Replies
Nicole-Smith

if(InMonth([Promised Payment Date], today(), 1), 1, 0)

This says if [Promised Payment Date] is in the month after today (denoted by the 1).

Not applicable

Just changed your Year condition to have greater than or equal to and added add months

= if(Month(Addmonths(Today(),1)) = Month(date('01/23/2014','MM/DD/YYYY')) AND Year(Addmonths(Today(),1)) >= Year(date('01/23/2014','MM/DD/YYYY')),1, 0)

iktrayanov
Creator III
Creator III

try

=If (fabs(Month([Promised Payment Date]) - Month(Today())) =1, 1,0)

Not applicable

Please try with MonthStart or InMonth functions like below:

Method 1: MonthStart

Let vDateCheck =  Num(MonthStart(AddMonths(Today(),1))) ;

IF(MonthStart([Promised Payment Date]) = $(vDateCheck) , 1, 0) AS NextMonthYr_Flag

Method 2: InMonth

IF(InMonth([Promised Payment Date], Today() , 1) , 1, 0) AS NextMonthYr_Flag