Forum Discussion
Advice on optimising SWITCH or alternative approach
- 1 year ago
Thanks. We looked further into calculation groups but in this case it seems to just make things needlessly more complex and more difficult to maintain. From further research it seems we should try to stick with the unpivot approach anyway, so we'll focus on comparing performance with the switch approach.
Thanks for your replies.
We did look at calculation groups and couldn't get it to work in this scenario.
But we might not be aware of more advanced techniques with calculation groups, could you maybe elaborate a bit on how you would set them up in this case?
- Anonymous1 year agoNot applicable
Hi styxbe ,
Thanks for the update.
In scenarios where each parameter is in a separate column, Calculation Groups can help reduce repeated logic across measures. Here's how you can set it up:
-
Create a base measure for each parameter column (e.g. [Parameter1 Measure], [Parameter2 Measure], etc.).
-
Create a Calculation Group where each calculation item returns one of those base measures.
-
Use the selected calculation item in your visuals or wrap it in a reusable pattern, depending on how you want the selection to work.
This allows you to centralize the switching logic and avoid repeating SWITCH statements in each measure.
Hope this helps. Please reach out for further assistance.
Please consider marking the helpful reply as Accepted Solution and giving kudos to assist others with similar issues.
- styxbe1 year agoFrequent Visitor
Thanks. We looked further into calculation groups but in this case it seems to just make things needlessly more complex and more difficult to maintain. From further research it seems we should try to stick with the unpivot approach anyway, so we'll focus on comparing performance with the switch approach.
-