Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Can anyone explain me How does Year to date(YTD) and Month to Date(MTD) works?
Hi,
There are many post related to the YTD and MTD
YTD :- this stands for Year to date means any metric value from Start of year and till date means today date and with help of SET expression we find
=Sum({$<Date = {'>$(=Max((YearStart(Date)))) <=$(=Max(Today()))'}>} Metrics )
MTD:- This stands for Month to date means Start of month which is current month to till date today date.
=Sum({$<Date = {'>=$(=Max((MonthStart(Date)))) <=$(=Max(Datefield))'}>} Metrics)
Regards
Anand
Generlly you start from a date on which you build a master calendar (look in the community, you will find several examples)
The calendar contains even week, month and year fields, I prefer to work with 201409 as month field or 201427 as week field because sorting and selection is easier.
If you need YTD just write in your expression a condition myDateField <= today() even with set analysis or not.
Hi,
There are many post related to the YTD and MTD
YTD :- this stands for Year to date means any metric value from Start of year and till date means today date and with help of SET expression we find
=Sum({$<Date = {'>$(=Max((YearStart(Date)))) <=$(=Max(Today()))'}>} Metrics )
MTD:- This stands for Month to date means Start of month which is current month to till date today date.
=Sum({$<Date = {'>=$(=Max((MonthStart(Date)))) <=$(=Max(Datefield))'}>} Metrics)
Regards
Anand
Hi Sadeep
You can also find the YTD and MTD flag fields as part of your MasterCalendar script.
In this case, we use the inyeartodate() and inmonthtodate() to calculate them.
The inyeartodate function will return true(-1) when your date from the dataset belongs to the period from the beginning of this year (01/01) until today.
Respectively, the inmonthtodate function will return true(-1) when your date from the dataset belongs to the period from the beginning of this month until today.
Regards
Agis