Forum Discussion
Performance with many SWITCH or IFs slow. Is there a solution with good performance?
- 4 years ago
Calculation groups may not help, the best performance can be obtained by using SWITCH but you have to pay attention to the details. See this article+video: Understanding the optimization of SWITCH - SQLBI
Calculation groups may not help, the best performance can be obtained by using SWITCH but you have to pay attention to the details. See this article+video: Understanding the optimization of SWITCH - SQLBI
- selimovd4 years ago
Most Valuable Professional
Thank you very much marcorusso , the approach mentioned in the article could solve the issue.
The visual with 20 measures that all of them use a SWITCH with 19 options went from 40 seconds to 1.8 seconds after optimization!
- ValtteriN4 years ago
Community Champion
Hi selimovd marcorusso,
Just proposing an alternative here that has worked pretty well in my models:
You couls use a field parameter to dynamically calculate the measure you want. This way we can skip the optimization process of SWITCH:I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/