Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

MTD ,PMTD,YTD,YMTD in Celender

Hi,

I am want to know is their any method where i can create MTD,PMTD,YTD,PMTD,WTD,PWTD etc through backend or in Calender?

I mean rather than creating expression at front end i can do it at backend itself and passing some flag in exp etc can able to achieve all.

Thanks

Regards

Abhay

7 Replies
marcus_sommer

Here you will find various examples to this topic and some more: How to use - Master-Calendar and Date-Values

- Marcus

sasikanth
Master
Master

HI,

Please fine the Document by HIC.

kavita25
Partner - Specialist
Partner - Specialist

you can create flags on Master Calendar...

MTD-PMTD

inmonth(today(),Date,0)*-1 as MTD_FLAG,

InMonthToDate(Date,$(vDateToday),-1,4)*-1 as LMTD_FLAG


YTD-PYTD


if(if(Month(date(Floor(Date)))<=3,(Year(date(Floor(Date)))-1)&'-'&(Year(date(Floor(Date)))),(Year(date(Floor(Date))))&'-'&(Year(date(Floor(Date)))+1))=if(Month(((today())))<=3,(Year(((today())))-1)&'-'&(Year(((today())))),(Year(((today()))))&'-'&(Year(((today())))+1)),1,0) as YTD_Flag,

inyeartodate(Date, $(vDateToday), -1,4)* -1  AS LastYTDFlag


WTD-PWTD


InWeek(today(),Date,0)*-1 as WTD_FLAG,

InWeek(Date,$(vDateToday),-1)*-1 as LWTD_FLAG

Hope it helps you!!!

Regards,

Kavita


abhaysingh
Specialist II
Specialist II
Author

hi kavita, what is vDateToday in your case?

kavita25
Partner - Specialist
Partner - Specialist

sorry I frgt to mention that..

It is a variable created on Master Calendar

let vDateToday = num(today());

abhaysingh
Specialist II
Specialist II
Author

Hi Kavita,

U write this code using today(), in that case its working perfectly i want, but only for current and last month i have,  i want if i select any year and Month, than selected year and their month shud be thier MTD and LMTD (their previous month).