Skip to Content
Technical Articles
Author's profile photo Viktoria Pallacks

SAC: Switching Measures of a Chart in a New ODE Story

With the new Optimized Design Experience in SAC the world of dashboards and reporting will change over the next years. Using scripting inside an ODE story can change the interaction and engagement level of a user with the delivered story. Although adding code to my story opens thousands of possibilities, we as SAC front-end story builders are not getting experts in SAC coding overnight. But with small additions and simple examples, we can already enhance our dashboard to be more interactive, more performant, and less static today. I want to show you a hands-on example where a little script in my ODE story helped me reducing the number of charts on my page (and with that performance), but still leaving the user the possibility to get familiar with the respective data.  

In our use case we wanted to provide charts for the actual headcount (#) as well as the share compared to the total workforce (%). Normally, we would have either enabled the actuals by tooltip or even added a second set of charts for the different measures to the page. In this case, we wanted to use scripting instead to give the user the option to switch between different measures using a switch. 

Step 1: Set up the chart with the measure you want to be shown initially, when initializing the page.  Step%201%3A%20Chart%20Set-Up

Step 1: Chart Set-Up

Step 2: Insert a switch to the position you want it to be used. We added images next to the switch to make the usage clearer, but the description is up to you.   

Step%202%3A%20Insert%20the%20Switch

Step 2: Insert the Switch

Step 3: Enter the switch script, either via the outline (left side) or via the options on the switch. A new tab your story will open named after the switch and onChange.  

Step%203%3A%20Edit%20the%20Switch%20Skript

Step 3: Edit the Switch Script

 

Step 4: Edit the switch script to change the respective measures. In the script, you must first indicate the switch name (1) and then the chart name (2). Afterwards, you can select the respective measures. In our case the share is a calculated measure and therefore is shown with its dimension ID (instead of a name).

Help: you can enter the coding help as well as the “Select Member”-Help by clicking Ctrl + Space. 

Step%204%3A%20Write%20the%20Script

Step 4: Write the Script

Step 5: Save your story and enter view mode to see your changes.  

Step%205%3A%20Save%20Your%20Changes

Step 5: Save Your Changes

With those five simple steps you can not only make your story or dashboard more interactive and user-friendly, but as well more performant and insightful. I am sure there are a lot more use cases out there for using this kind of simple measure switch. You don’t have to be an expert in coding to enhance your story in an interactive way! 

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ratnesh Sonawane
      Ratnesh Sonawane

      Very informative. Is there a possibility that I do not change the measure but switch between 100% & absolute numbers in a stacked bar using the same logic?

      Author's profile photo Viktoria Pallacks
      Viktoria Pallacks
      Blog Post Author

      Hey Ratnesh,

      switching between % and absolute numbers in this case always involves creating two respective measures (one for the share in % and one for the absolute value). Afterwards you can switch measures by the logic shown above for all kind of charts.

      Best, Viktoria