cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Changing Measures in Chart

tilted
Explorer
0 Kudos

Hello,

i am trying to resolve the following request: 

We have a combined stack and line chart with two measures inside of it (A1 and A2). 
Now i have two more pairs of measures which are also displayed together (B1 and B2 OR C1 andC2).
So in total i have 6 measures which are displayed in pairs (A1 and A2 OR B1 and B2 ORC1 and C2).  

For now i am using two measure input controls (MI1 and MI2) where i always have to select the pair like measure A1 from MI1 and A2 from MI2. The problem using this way is next to the fact that it is "click intensive" that the sorting is also not working like sorting from highest to lowest. 

Do you have any suggestions how to make dynamic selection of two measures in a chart easier or that we only have one measure input control instead of two?

Kind regards
Korab 

View Entire Topic
akhilgs
Explorer
0 Kudos

Hi @tilted, since you know which measures are grouped together, you can achieve the same using scripts, while at run time a drop down can be used which shows the two groups of measures that you want to pass to your chart/ graph or any other widget. Please refer to the below blogs, these will help out as a starting point and you can expand up on it.

Dynamically Changing Measures And Dimensions in SAP Analytics Cloud 

Best Practice: Filter Table and Chart Through Dropdown (Single Selection) 

List the members of a dimension in a dropdown and filter table according to this dimension member 

 

tilted
Explorer
0 Kudos

Hello @akhilgs,

thank your for the hints

I am now struggling with the issue that i can't pass measures or modify widgets which are on a different page. 

In Page 1 I have a button which changes all measures in the charts.
In Page 2 i have also a table (Table_2) where i can't makes any changes on that because the table iis not on the same page like the button.

So I cant do Table_2.removeMeasure("XXXX", Feed.ValueAxis);

Do you have any suggestion for that? 

 

akhilgs
Explorer
0 Kudos

Hi @tilted you can try using script variables, store the result set of the table in the second page into a script variable, access that variable from the button in the first page. Scripts written in a page can access only the widgets in that page directly, but I would recommend that you create another button for page 2 as the user has to move any way to page 2, if the scripts for both the buttons are the same then you can create a function(under script objects) and then call the same function for both the button clicks with difference only in the parameters.

 

tilted
Explorer
0 Kudos

Hello @akhilgs,
what i did is basically what u mentioned creating two buttons on two pages with the same scripting.
I am insecure with the script function itself. What I want is when clicking button 1 on page 1 that also button 2 on page 2 is automatically clicked. 

What should i define inside the function and how to call it? 

Thank you in advance! 

akhilgs
Explorer
0 Kudos

Hi @tilted 

You don't want to use the same script in both the buttons, you create a function, 

akhilgs_0-1715740039148.png

In the function you input your scripts, then this function should be called when the button(s) are clicked the only changes will the parameters to the function if you have any, also am not sure of any way to emulate a button click in SAC, as the events available for a button are onClick & onLongPress, If you know the set of measures that you want your table in the second page to have then as I mentioned before on the button click in the first page, save those measures into a script variable and this variable be applied as filter to the table when the page containing the table is initialized.