Skip to Content
Technical Articles
Author's profile photo Sharon Zhou

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.

Scenario:

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%20of%20Method1%20and%20Method2

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

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Henry Banks
      Henry Banks

      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 (sap.com)  Hope you can help!

      Regards

      H

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      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,

      Sharon

      Author's profile photo Former Member
      Former Member

      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:

      All%20data

      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.

      Thanks.

      Clive

       

       

      All data

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      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:

      Best,

      Sharon

      Author's profile photo Former Member
      Former Member

      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.

      Cheers

      Clive

       

      Author's profile photo Former Member
      Former Member

      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?

      Regards

      Clive

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      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.

      Best,

      Sharon

      Author's profile photo Former Member
      Former Member

      Hi Sharon

      So is this a bug that needs fixing? I want to avoid 'hard coding' by selecting members, I need a dynamic filter.

       

      Thanks

      Clive

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      Hi Clive,

      This is a by-design behavior. You can submit a request to SAP Idea Place for further enhancement.

      Best Regards,

      Sharon

      Author's profile photo Bangbang Bian
      Bangbang Bian

      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)

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      Hi Bruce,

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

      Best,

      Sharon

      Author's profile photo Yuting Zeng
      Yuting Zeng

      Hi,

      I am trying to add weekly data in the hierarchy or show the weekly data in the widget. Do you have any idea? Here are the details!

      SAC Usage dashboard ACTIVITY_LOG model - how to include Week level to "Date" hierarchy | SAP Community

      Thank you for your help!!

       

      Best,

      Yuting

      Author's profile photo Sharon Zhou
      Sharon Zhou
      Blog Post Author

      Hi Yuting,

      You may use the "flexible time" concept in SAC to address your question. Here is the documentation that could be helpful for you. https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/6a22f9081ab540acb9e2cdbe4112ee11.html?q=flexible%20time

      BR,

      Sharon