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: 
khadar
Contributor III
Contributor III

MTD , YTD in Qliksense

Hi All,

can someone please help me how to create YTD & MTD buttons in qliksense from script load.

I have requirement where by clicking the YTD buttons all the data will be selected as per YTD.

 

Regards,

khadar

 

 

Labels (1)
1 Reply
chris_djih
Creator III
Creator III

Consider creating a master calendar where you define YTD and YTM as field based on the master date field.

IF(NUM(NUM(Month(DateField),'00')&NUM(Day(DateField),'00'))
   <= NUM(Month(today()),'00')&NUM(Day(today()),'00'),1,0)  as Date_YTD,
NUM(NUM(Month(DateField),'00')&NUM(Day(DateField),'00'))
   >= NUM(Month(today()),'00')&NUM(1,'00') 
and NUM(NUM(Month(DateField),'00')&NUM(Day(DateField),'00'))
   <= NUM(Month(today()),'00')&NUM(Day(today()),'00'),1,0)  as Date_MTD 

please check in script editor for missing ')' since i wrote this script from memory.
Then you can easily filter Date_YTD  = 1 or Date_YTM =1

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.