Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date functions

Can you please help me YTD() and MTD() functions with examples?

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Month to date. The period of time from the 1st of the month until the current date. If current date is 21-03-2014

MTD = 01-03-2014


Week to date from the beginning of the week in which the date falls in, to the date


View solution in original post

6 Replies
ashfaq_haseeb
Champion III
Champion III

HI,

Look at the below post.

YTQ, QTD, MTD and WTD

Regards

ASHFAQ

maxgro
MVP
MVP

here a good example, using load script (master calendar) and set analysis

YTD and MTD Counts

Anonymous
Not applicable
Author

Hi.............

   Thanx for ur reply............

  Suppose date selected is 21-03-2014 then YTD is 01-01-2014 to 21-03-2014.What is the

   MTD(21-03-2014)=?

   WTD(21-03-2014)=?

Please help me?

maxgro
MVP
MVP

Month to date. The period of time from the 1st of the month until the current date. If current date is 21-03-2014

MTD = 01-03-2014


Week to date from the beginning of the week in which the date falls in, to the date


its_anandrjs

Basic YTD and MTD calculation done by variables or SET expression you can try like

YTD Calculation:-

Sum({$< YourDatefield = {'>$(=Max((YearStart(YourDatefield)))) <=$(=Max(Today()))'}>} Metrics)

Or

Sum({$<Datefield = {'>$(vYearStart) <=$(vCurrentMonth)'}>} Metrics)

MTD Calculation:-

Sum({$<YourDatefield = {'>=$(=Max((MonthStart(YourDatefield)))) <=$(=Max(YourDatefield))'}>} Metrics)

Or

Sum({$<YourDatefield = {'>=$(=Max((MonthStart(Today())))) <=$(=Max(today()))'}>} Metrics)

its_anandrjs

Hi chandinig,

If you got correct answer from the thread so mark the thread as correct / Helpful for references

Regards,

Anand