
🚀Problem Statement
In SAP Analytics Cloud (SAC), users often need to filter data in tables with both dimension and measure input controls. Typically, you can use:
However, when tables are dynamic (due to dimension and measure input controls), a direct measure filter using scripting is not available. This limitation creates the need for a custom solution.
🧩 Challenges Faced
✅Output
Filter.gif
🛠️ Solution Approach
To overcome these challenges, we use a calculated measure combined with scripting. Here’s a structured approach:
✅Step 1: Create a Script Variable
✅Step 2: Create an Input Field and Link to Script Variable
Ensure Real-Time Update:
✅Step 3: Create a Calculated Measure
IF ("Total Sales" >= ScriptVariable_1, "Total Sales") |
Explanation:
✅Step 4: Add the Calculated Measure to the Table
✅Step 5: Handle Empty Input with Scripting
If no input is provided, SAC won't display any data since the calculated measure in the table awaits input. To address this, the following script ensures the input value defaults to 0 if left empty.
Script Code:
// Get the input value var inputValue = InputField_1.getValue();
// Check if the input field is empty using a boolean comparison var isEmpty = inputValue === "";
// Set the input to "0" if it is empty if (isEmpty) { inputValue = "0"; InputField_1.setValue("0"); // Reflect 0 in the input field }
// Show a success message Application.showMessage(ApplicationMessageType.Success, "Total Sales filter value set to: " + inputValue);
|
💡Explanation:
⚙️UI/UX enhancement:
🎯Conclusion
This approach effectively handles dynamic measure filtering using input fields and scripting in SAC. Users can confidently filter data based on their criteria, while ensuring a smooth user experience with clear feedback.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |