4 Replies Latest reply: Nov 11, 2014 6:12 AM by Agis Kalogiannis

# YTD and MTD

Can anyone explain me How does Year to date(YTD) and Month to Date(MTD) works?

• ###### Re: YTD and MTD

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.

• ###### Re: YTD and MTD

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

• ###### Re: YTD and MTD

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