Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Date issue

Hi Friends

I have written under mentioned script in my data load

IF(Num(YEAR(CEN_CL_LOSS_DATE))& num(MONTH(CEN_CL_LOSS_DATE))=Num(YEAR(CEN_CL_INT_DATE))& num(MONTH(CEN_CL_INT_DATE)),'SAME_MONTH',
IF(DATE(AddMonths(CEN_CL_LOSS_DATE)=DATE(AddMonths(CEN_CL_INT_DATE,-1),'LAST_MONTH'),'OTHER_MONTHS'))AS PERIOD,

But it does give a error message with 

"Error in expression:AddMonths takes 2-3 parameters"

Kindly help me to solve the issue.

My requirement is  if Month & Year of  CEN_CL_LOSS_DATE= month & year CEN_CL_LOSS_DATE it should be categarised as same month. If the two fields are not equal by 1 month it should be 'Last Minth' otherwise 'Other Months'

1 Reply
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

I guess the problem lies in this part of the sentence:

IF(Num(YEAR(CEN_CL_LOSS_DATE))& num(MONTH(CEN_CL_LOSS_DATE))=Num(YEAR(CEN_CL_INT_DATE))& num(MONTH(CEN_CL_INT_DATE)),'SAME_MONTH',
IF(DATE(AddMonths(CEN_CL_LOSS_DATE, 0)=DATE(AddMonths(CEN_CL_INT_DATE,-1),'LAST_MONTH'),'OTHER_MONTHS'))AS PERIOD,

 

https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/DateAndTimeFunctions/a...