Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys
I have the question how to create flag for LMTD,LQTD,LYTD for all years in data. I tried this script below but it work for only MTD, QTD, YTD.
MTD script:
if(month(tempdate) = month(today(1)) and daynumberofyear(tempdate) <= daynumberofyear(today(1)),1,0) as MTDflag
Could you guys help me with that ?, thank in advanced
Based on your formula i figure out how to calculate LMTD and so on. Tks a lot
The right script is:
if(AddMonths(month(tempdate),0) = month(AddMonths(today(1),-1)) and daynumberofyear(tempdate) <= daynumberofyear(AddMonths(today(1),-1)),1,0) as MTD_LY_flag
Since you already got the flag for current year, May be use below condition for last year?
if(AddMonths(month(tempdate),-1) = month(AddMonths(today(1),-1)) and daynumberofyear(tempdate) <= daynumberofyear(AddMonths(today(1),-1),1,0) as MTD_LY_flag
Based on your formula i figure out how to calculate LMTD and so on. Tks a lot
The right script is:
if(AddMonths(month(tempdate),0) = month(AddMonths(today(1),-1)) and daynumberofyear(tempdate) <= daynumberofyear(AddMonths(today(1),-1)),1,0) as MTD_LY_flag