Forum Discussion
Slow switch measure
Hello,
I was wondering if somebody has found a working solution for the slow switch statement problem?
For my dashboard I would like to switch between over 100 measures (I call this the base measure). All the measures inside the switch statement are simple column sums and averages. This base measure is used in all kind of other measures, such as YOY calculations. Performance slows down when more measures are added to the switch statement.
I have read multiple posts about this topic, but none of the proposed solutions worked for me unfortunately:
- https://www.reddit.com/r/PowerBI/comments/gaytnc/measure_slow_due_to_weird_switchselectedvalue/
- https://community.powerbi.com/t5/DAX-Commands-and-Tips/Slow-Performance-Switch/m-p/1795454#M37826
- https://community.powerbi.com/t5/Desktop/Slow-Switch-Statement/m-p/1085972#M502954
The power bi report server may 2021 feature summary announced that "A performance improvement has been made to SWITCH function with many branches and deeply nested IF functions to eliminate branches which are not selected by user filters or slicers earlier in the calculation pipeline." (https://powerbi.microsoft.com/en-us/blog/power-bi-report-server-may-2021-feature-summary/#perf). But in my case, performance is still too slow.
In addition, I tried to solve this issue by making use of calculation groups. But the same problem applies here. The larger the number of calculation items, the slower the performance; https://community.powerbi.com/t5/Issues/Calculation-Group-slows-down-as-the-number-of-Calculation-Items/idi-p/1706064.
Does anybody have an idea how this issue could be solved? Thanks in advance!
Dominique
-----------------------------------------------------------------------------
Update 6 july 2021:
I would like to thank everyone for helping out π
The solution we chose to implement is dividing the measures over multiple 'switch' measures. Instead of having a single page with many measures, we have multiple copies of the page, each with its own switch measure containing 5 measures at max, using calculation groups to replace the measures in the visuals.
12 Replies
- D0miniqueFrequent Visitor
Hi MFelix , thank you for your suggestion! I have tried this option already following the next example;
https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expressions/.
Unfortunately, this did not improve the performance. Many calculation group items lead to the same perfomance issues as many measures in the switch statement; https://community.powerbi.com/t5/Issues/Calculation-Group-slows-down-as-the-number-of-Calculation-It....- StefanoGrimaldiResident Rockstar
try running a performance analysis and show here the results, also take the dax from those measure and run them on the dax studio to get a better view of the problem, the analysis could show its a enterily different problem and not the dax measures itself.
also look for the ugly babies: https://www.youtube.com/watch?v=91D1WrNrHtY