Skip to Content
Technical Articles
Author's profile photo Rajendra Kodavati

MTD, YTD, YTG (YearToGo) Calculations in SAP Analytics Cloud

As like the other calculations, MTD, YTD and YTG (in case of forecast data) are commonly in need calculations particularly when we have to use time dimensions like Year/Month(Fiscal Periods).

Here I want to discuss about the above mentioned time calculations when we are analyzing the data in story for the current Year. Product offers us the direct functionality or relevant flags for MTD and YTD.

We have direct flags for Current Periods and Previous Periods with sub flags like 1.Full Period 2.To Date. “To Date” is very much useful for the calculations of MTD and YTD. All these options are available only when the object that is created as Date Dimension in the SAC Model.

Lets Consider this example we as i have Forecast Version of data coming from model, this is a combination of Actual and Planning data.My MTD and YTD Calculations would give actual data and where as YTG is obviously forecast information.

Data is displayed as below:

Base Table

MTD : MonthToDate calculation, want to display Sales measure, we are going to restrict measure based on the Order Date to the Month Granularity by creating a restricted measure, we can restrict “Sales” by the standard system date. Under To Date option, we need to select “Month” granularity for MTD.

 

Now the values for “MTD Sales” will have data for Aug 2020 only as the current system date is 4th August 2020.

 

YTD: YearToDate, Measure “Sales” has to be restricted by the till date in the current year from 1st January of the current year. We have the direct options enabled for us based on the date dimension. But here the granularity would be “Year”.

 

Now the YTD Values are being shown from starting of the current year to current month. Both MTD and YTD show us the data from Actual version of data.

YTG:YearToGo, Measure “Sales” Should be restricted from current Month to till the end of the year. However there is No Direct Flag to achieve the same. We can work around for this calculation with the Calculation Measure rather than Restricted Measure.

In my current scenario, Measure “Sales” has data for the entire Current Year(Jan – Dec) and Measure “YTD Sales” has data Till Current Month ( Jan – Aug), Calculated measure which subtracts YTD from the Full Year can give me YearToGo. Which is forecast value, helps me to analyze the expected Sales for future months.

 

“YTG Sales”,will now show data for future periods:

 

Something seems to wrong here as we could see the data for the current period also for “YTG Sales”. It’s not the Case 🙂 As I have data granularity Day for Date Dimension on which these Date Calculations are performed, as the days completed in current month are added to YTD calculation and the remaining days of the current month are considered in the YTG Calculation. Thanks to Product for the absolute Precision. We can consider YearMonth/FiscalYearPeriods objects as date dimensions to consider only data granularity till Month Level.

I have now removed Order Date from the table view to see the consolidated level of data for these Date Calculations

Along with MTD,YTD and YTG, many other date calculations like CurrentYear,YearToQuarter and Previous Periods like last Month,last Quarter and Last Year can be derived on the objects once they are created as Date Dimensions.

Thank You …!!!

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Raheel KHAN
      Raheel KHAN

      lovely very well explained

      Author's profile photo Rajendra Kodavati
      Rajendra Kodavati
      Blog Post Author

      Thanks Raheel !

      Author's profile photo Aleksey Salinin
      Aleksey Salinin

      it’s a pity that it doesn’t work yet for live connections...

      Author's profile photo Stefan Artini
      Stefan Artini

      Hi Aleksey Salinin I totally agree with you. Use of time functionallity for BW live data is urgently missed as one can see by the high voted improvement requests covering that topic. You can vote for

      Dynamically Add Time Calculation option needed for SAP BW Live connection models

      And also have a look in the comments, where Nils Rottgardt listed a lot more pending improvement requests for other issues regarding time series support for BW Live Data

      Author's profile photo Bhargavi Gali
      Bhargavi Gali

      Thank you for such an informative and helpful blog.

      Can we create this calculations based on an input control? Like if we add period as a input control and my YTD, MTD and YTG calculations should consider the selected period not the current period.

      Is it possible to achieve this in SAC?

      Author's profile photo Rajendra Kodavati
      Rajendra Kodavati
      Blog Post Author

      Hi Bhargavi,

       

      Yes, we can control Month or time period selection not to be only driven by System Date / Period, we can go for inserting an Input control / Story Filter and select date dimension we can options as :

       

      and then we can define "Custom Current Date / Period "  and "Granularity " like Year, Half Year, Quarter, Month ...etc. PFB :

       

      Hope that answered your question.

      Author's profile photo Bhargavi Gali
      Bhargavi Gali

      Hi Rajendra,

      Thank you very much. This worked for our requirement. But we have to calculate the YTD average and YTG average too in addition to MTD, YTD and YTG. I was able to get the YTD average using Aggregation calculation but for YTG I am unable to find any solution. Do you have any workaround for Average calculation?

      Thanks in Advance,

      Bhargavi.