Skip to Content
Technical Articles
Author's profile photo Jai Gupta

Use Cross calculation to model BW like characteristic structure on Datasphere Analytic Models

Figure1%3A%20Reference%20Image%20showing%20cross%20calculation

Introduction

As part of this blog, I will be demonstrating the approach of  “How a SAP BW like characteristic structure be created on top of SAP Datasphere Analytic Model using SAP Analytics Cloud(SAC) Cross Calculation feature”. For this, we will connect SAC to Datasphere via live Datasphere(DS) connectivity and utilize optimize design story mode on top of Analytic Model for SAC story.

For demo purpose, I will use the Country dimension from my test Analytic Model to create a SAC Cross Calculation named Region with the following elements:

  • Restricted Cross Calculation elementsEMEA(Europe, Middle East and Africa), NA(North America), AP(Asia Pacific) and Total. As the name suggests these elements will be used to show data for various important regions and respective total of all countries within my dataset.
  • Calculated Cross Calculation elementOthers. This will show the data from the countries which are not present in any of the regions created above using Restricted Cross Calculations.

Note: This feature to create cross calculation on live connections with Datasphere in SAC is available from Q3 QRC SAC onwards.

Background

Before we start with the use case, it is better to revisit what Cross Calculations and their functionality within SAC. On a high level, below elements can be created using SAC Cross Calculation feature:

  • Restricted Cross Calculation – For restricting the dimensions to certain values or ranges.

          Figure%202%3A%20Restricted%20Cross%20Calculation

Figure 2: SAC Restricted Cross Calculation

          This is similar to creating a selection within the BW Queries.

    Figure%202%3A%20BW%20Selections

Figure 3: BW Selections

  • Calculated Cross Calculation – To perform calculations like sum, multiplication etc. only on the cross-calculation elements.

Figure%204%3A%20Calculated%20Cross%20Calculation

Figure 4: Calculated Cross Calculation

          This is similar to creating a formulas within the BW Queries.

Figure%205%3A%20BW%20Formulas

Figure 5: BW Formulas

  • Aggregation – To change the default aggregation behavior like Exception Aggregation(currently not supported with DS live connection)

Further, following blogs, provides a quick refresher on the functionality, and can be used further to understand the features in detail.

https://blogs.sap.com/2020/03/19/creating-cross-calculations-in-a-table/

https://blogs.sap.com/2020/06/14/types-of-calculations-in-cross-calculation/

Steps

1.  As a first step, I will create new story in optimized design mode.

Figure%206%3A%20Create%20story%20in%20optimized%20design%20mode

Figure 6: Create story in optimized design mode

2.  Next, I will select option Add New data connection for using DS live connection, as shown below, and then select option Data from an existing dataset or Model from the pop up.

Figure%207%3A%20Add%20new%20dataset%20to%20story

Figure 7: Add new data to story

Figure%208%3A%20Select%20Dataset/Model

Figure 8: Select Existing Dataset/Model

3.  Next, I will select my test Analytic Model and add the Table widget to the story.

Figure%202%3A%20Select%20base%20Analytic%20Model%20from%20live%20DS%20connection

Figure 9: Select base Analytic Model from live DS connection

Figure%2010%3A%20Add%20Cross%20Calculation

Figure 10: Add table widget

4.  In the section Rows within the Builder, I will select Add Dimensions and choose Cross Calculation. This will add a Cross Calculation to the rows.

Figure 11: Add Cross Calculation

5.  Now, I will click on the three dots icon and select Add calculation.

Figure

Figure 12: Create Cross Calculation Elements

6.  From the opened dialog, first, I will choose Restricted Cross Calculation.

Figure%2011%3A%20Cross%20Calculation%20Selector

Figure 13: Choose Restricted Cross Calculation from dropdown

7.  This will open the new dialog which is similar to standard Restricted Measure UI in SAC. The only difference here is we can’t choose a single measure within selection context and by default the restrictions applies to all the measures within SAC instead of single measure.

Figure%2012%3A%20Create%20Restricted%20Cross%20Calculation

Figure 14: Restricted Cross Calculation Dialog

8.  Next, I will create Restricted Cross Calculations’ for creating regions EMEA, NA and AP as shown below. Also, I will create another element Total to get the total from all the countries. For BW users, this is similar to creating Selection within a structure.

Figure%2014%3A%20Create%20Restricted%20Cross%20Calculation%20for%20EMEA

Figure 15: Create Restricted Cross Calculation for EMEA

Figure 16: Create Restricted Cross Calculation for NA

Figure%2015%3A%20Create%20Restricted%20Cross%20Calculation%20for%20APJ

Figure 17: Create Restricted Cross Calculation for AP

Figure%2016%3A%20Create%20Restricted%20Cross%20Calculation%20for%20Totals

Figure 18: Create Restricted Cross Calculation for Total

9.  Further, I will create Calculated Cross Calculation for Others. Here, I will subtract the cross-calculation element Totals with the other elements EMEA,NA and AP, created in above step using Restricted Cross Calculation, to capture data from countries which are not present in any of these regions. For BW users, this is similar to creating a formula within a structure.

Figure%2017%3A%20Create%20Calculated%20Cross%20Calculation%20Others

Figure 19: Create Calculated Cross Calculation Others

10. Once done, I will go to my cross-calculation and will rename it as Region, as shown below.

Figure%2018%3A%20Rename%20Cross%20Calculation%20as%20Region

Figure 20: Rename Cross Calculation as Region

Figure%2019%3A%20Cross%20Calculation%20Region%20Overview

Figure 21: Cross Calculation Region Overview

11. The output in Table widget will look like below.

Figure 22: Cross Calculation output in Table widget

12. Further, I will add Dimension Controlling Area to do further drill down and the SAC output will change accordingly.

Figure%2021%3A%20Add%20Controlling%20Area%20to%20Drill%20down

Figure 23: Add Controlling Area to Drill down

Figure%2020%3A%20Cross%20Calculation%20output%20in%20Table%20widget

Figure 24: Cross Calculation output with controlling area drilldown

13. Further, I can also drag Region to section Columns, as shown below.

Figure%2023%3A%20Cross%20Calculation%20in%20Columns

Figure 25: Cross Calculation in Columns

14. Also, same Cross Calculation, Region, can be used across widgets within same story. As an example, I will add it to chart by enabling the Cross Calculation from chart add-ons, as shown below.

Figure%2024%3A%20Enable%20Cross%20Calculation%20chart%20add%20on

Figure 26: Enable Cross Calculation chart add on

15. Next, I will click on the label + At least 1 Cross Calculation required and select the Cross Calculation elements of the Cross Calculation required in the chart widget.

Figure%2025%3A%20Add%20Cross%20Calculation%20to%20chart

Figure 27: Add Cross Calculation to chart

Figure%2026%3A%20Cross%20Calculation%20elements%20selected%20for%20chart

Figure 28: Cross Calculation elements selected for chart

16. After that, I will add the Cross Calculation to the dimensions by clicking on label Add Dimension to see the respective data in the chart.

Figure%2028%3A%20Add%20Cross%20Calculation%20to%20chart%20dimensions

Figure 29: Add Cross Calculation to chart dimensions

Figure%2029%3A%20Cross%20Calculation%20output%20in%20chart

Figure 30: Cross Calculation output in chart

Limitations

  • Formula collision is currently not there and by default Calculated Cross Calculation will be preferred over Calculated measure in the widget.
  • Exception Aggregation scenarios are not present currently within Cross Calculations

Summary

The blog explains the way a cross calculation can be created on top of Analytic Model in Datasphere via live connection in SAC.

Further, it highlights the similarity and limitations cross calculation have with Characteristic structures within BW queries.

Further Links

Find more information and related blog posts on the topic page for SAP Data Warehouse Cloud.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Julian Juraske
      Julian Juraske

      Hello,

      I also have to say if you have a look on the Performance you would ALWAYS try to give the SAP HANA as much to do as possible. (Rather than the Cross calculation done in the Browser)
      I would therefore rather create a Hierarchy in Datasphere than creating a Restriction/Calculation in SAC.

      If the Customer is following the SAP principicals and uses the DSP as a DataFabric, the Business can also easly change the Region assosiation, or even better the Region is delivered by the IT and therefore is company wide the same (Data Gouvernance).

      Author's profile photo Jai Gupta
      Jai Gupta
      Blog Post Author

      Hi Julian,

      Thanks for the comment.

      To clarify, Cross calculations are also pushed down to HANA, they are not calculated in the browser. It uses MDS engine in HANA for processing.

      Also, just to highlight, cross calculations offers more flexibility than hierarchies, here basically we can use multiple dimensions for restricting the values or doing calculation. Also, restrictions can differ across elements within Cross Calculation elements. For example, I can create a element EMEA with only Country restriction and element EMEA_2019 with Country and Year restrictions.

      Further, input controls can be used within these elements to dynamically provide the restrictions or calculations within SAC.

      Regards,

      Jai

      Author's profile photo Julian Juraske
      Julian Juraske

      I thought all Calculations within SAC (e.g. Restricted or Calculated Keyfigures ) are done on the Users End not on the underlying SAP HANA of the Data Source ?

      Is there a offical Document where the Calculation is taking place and if the Source Type makes any Differnece (e.g. SAP BW, Datasphere or Local)?

      The Restriction you create is only for that Story or for the whole Model ?

      Author's profile photo Jai Gupta
      Jai Gupta
      Blog Post Author

      Hi Julian,

      It can be checked using network tracing in the web browser. If interested, SAP Note can be referred - https://me.sap.com/notes/2838921 to check the raw INA calls SAC is sending to HANA for cross calculation.

      In Getresponse, you can search for cross calculation element with its name to see the INA call to MDS. It will look like something as shown below:

      Regards,

      Jai

      Author's profile photo John Brunton
      John Brunton

      Thanks!  As a former old-school BW person, it's been a challenge to recreate Structure functionality (specifically with mixed characteristics) in the non-BW HANA world over the years.  It's a pity it's not a re-usable element yet (i.e. it's only Story specific) but it's a huge step closer.  Have to go play now!