Skip to Content
Technical Articles

SAP Analytics Cloud In-story Calculation Series – Blog1: Compare YTD sales with previous YTD sales

This is the first blog of SAP Analytics Cloud In-story Calculation Series. If you are interested in this topic, you can click here to have an overview of the whole series.


Your sales department would like to investigate in the year-to-date sales and compare it with year-to-date sales of last year.

In-story Calculations:

  • Quick Time Calculation
  • Restricted Measure

Method 1: Quick Time Calculation

You can use either Quick Time Calculation or Recommended Comparisons to perform this common calculation with a few clicks!

Add a Time Dimension to Chart

Let’s take a look at a Quick Time Calculation in action. You can add a time-based dimension to the chart, SAP Analytics Cloud will enable Quick Time Calculation in the selected measure.


Choose “Year to Date” Calculation

In this case, we choose the “Year to Date” calculation. Then we can adjust the chart view based on the business needs.  Some common adjustment includes selecting hierarchy and setting filters.


Select Recommended Comparisons

With SAP Analytics Cloud, comparing sales performance in current and last year can be done easily and quickly. By clicking on the Recommended Comparisons, SAP Analytics Cloud generates instant insights based on our dataset. Here we select “Previous Year”, then we will be able to see the comparison chart.



Method 2: Restricted Measure

After introducing method 1 – Quick Time Calculation, which is a “shortcut” to obtain your desired result, I am going to illustrate a more comprehensive way for you to achieve the same result as method 1.

Create Restricted Measure

The basic concept of this method involves first restricting the sales data to only show the running total results of the current and last year respectively and then using variance to make comparisons between them. Now let’s create two restricted measures in action.


Create Variance

By comparing these two restricted data and styling the variance, the bar chart below indicates that we have obtained the same result as method 1.



Results of Method1 and Method2


At this point, I bet you have learned something new about SAP Analytics Cloud. Do not hesitate to experiment with your dataset right now! Come back here and share with us your experience with the in-story calculation functionality.

The next blog post will talk about how to use In-story Calculation to create a what-if scenario: simulate quantity sold under different discounts.

Don’t hesitate to follow this series if it’s useful for you!



* The product interface may vary depending on the product version

You must be Logged on to comment or reply to a post.
  • Hi Sharon Zhou

    Many thanks for the informative blog. I'm a big fan of these quick 'tooltip features', especially the 'add Time calculations'.

    One area that does challenge our customers however is that these Time Calculations are (to the best of my knowledge) currently only for Import/Acquired connections, but are still a future roadmap item for Live connection paradigm (i'm representing especially our BW and S/4 install base here)

    Whilst Recommended Comparisons and Variance charts are possible with Live connection, it would be awesome to have parity for quick time calculations, as asked for by the community here Improvement Request Details - Customer Influence (  Hope you can help!



    • Hi Henry,

      Thanks for your feedback.

      Closing the calculation gaps between Import connections and Live connections is what we are working for. With this Road Map Explorer, you can track the detailed product plan of SAP Analytics Cloud.

      Best Regards,


  • Hi Sharon,  I've a simple chart for monthly net sales. I've added a variance to show previous year and this works ok when my chart has data from 01.2019 through to 01.2021:


    However I don't want to display 2019 data as it adds no value to the chart. When I filter to 01.2020 to 01.2021 the variance isn't available:

    Is this what you'd expect? I had hoped that the variance definition to compare to previous year would override the filter.





    All data

    • Hi Clive,

      I tried from my end and it worked. I notice there is a warning message in your second screenshot. Maybe you can use this warning message to troubleshot.

      Here is my result:



  • Hi Sharon, Thanks for your quick response. The warning is:

    I'm using a widget filter for date. I tried using a story filter instead but I have the same issue.




  • Hi Sharon,  I'm setting a dynamic filter in the chart builder pane (looking back 12 months) to give a rolling 12 month analysis:

    I tried filtering by selecting 2021 and 2021 directly in the chart and this gives the correct analysi and no warning message. So the issus seems to be just when a filter is set using the chart builder pane. I also tried a fixed filter in the builder pane but the gives the same warning. Maybe you could see if you can replicate this?



    • Hi Clive,

      It seems the back-end filtering mechanism is different between "Filter by Member" and "Filter by Range" in the Builder panel. Because when using "Filter by Member" in the Builder panel, we always get the desired result. While using "Filter by Range", then not. Maybe you can try to use "Filter by Member" in the Builder panel to always get your desired outcome.



  • Hi Sharon,

    My story is created based on BW live data model, but i cannot see "Add Time Calculation".

    if the quick time calculation is not supported for BW live data model?

    Best Regard,

    Bao Jianxin (Bruce)

    • Hi Bruce,

      Currently, quick time calculation is not supported on top of live BW connection. You can add your vote for this enhancement here.