SAC — Linked analysis with code
In this story I’ll show you how to get the data from a table by clicking on a value, to use it as a filter for another figure. This development acts as Linked Analysis in SAP Analytics Cloud.
If you are a SAP Analytics Cloud Consultant, you will be familiar with the famous “Linked Analysis” method, which is used to filter some figures based on others:
Why then might it be interesting to know another way to do linked analysis? You might need to retrieve specific data from a table, transform it using code, and apply it to another figure.
Get Nora Roser Tamarit’s stories in your inbox
Join Medium for free to get updates from this writer.
This example will show the filtering from the value of a table to an indicator, so that by clicking, for example, on the value 649, the information from that data line will be obtained, in this case China and the month 05.2022, to then use it as a filter for the KPI on the right.
The table scripts are edited and the option is selected “onSelect”:
Using this code, the value of the dimensions in rows country and year/month of the table is collected on the one hand. On the other hand, these values are simply filtered in the figure, in this case the KPI.
Code:
var COUNTRY = Table_1.getSelections()[0]["0COUNTRY"]; // Get country value of the data line of table
var MONTH = Table_1.getSelections()[0]["0CALMONTH"]; // Get month-year value of the data line of table
//Filter de values in the Chart KPI
Chart_1.getDataSource().setDimensionFilter("0CALMONTH",MONTH);
Chart_1.getDataSource().setDimensionFilter("0COUNTRY",COUNTRY);






