cancel
Showing results for 
Search instead for 
Did you mean: 

Switch Performance Issue

Hi recently i noticed serious performance issues on my production datasets and i created small dataset which is showing what the problem is.
I have create 4 type of measures 

  1. Original : 
    Measure = SUMX('Table',SUM('Table'[Value])*RAND()) // just doing some random stuff
  2. Slow nested with 3 levels of nesting. Here i do swtich with selectedavlue from other table, and based of selection i do always same calcualtion. Idea is just to have 10 possibilities to see that measures is gettgin slower. I have 3 levels in depth
  3. Fast nested calcualtion is just direct refecencing of same measures used in Slow Nested. Here we dont have swithc
  4. VAR Bad Practice is similar like Slow nested but instead of evaluating only one measure based on selected values, here i declare 10 variable first, and then use variable values in switch.

MS swtich bug - Power BI Desktop.png

Now i do testing by changin value on switch on the right.

As you can see Slow nested is by far worst option and from my understanding it looks like all expreisons are being evaluated for no reason (only one with selectedvalue should be evaluated).
Another thing that came as suprasing is that "VAR bad practice" is performing good.

Was something changed in calculation engine?


 

 

 

 

 

 

 

 

 

 

 

 

 

 
 
Status: New
Comments
Member

download PBIX here

Community Support Team

@morz3d 

 

Take a look at https://www.sqlbi.com/topics/optimization/ and create a support ticket for assistance if necessary.

Member

Thanks @v-chuncz-msft 
MS is currently not dealing with support ticket regarding DAX.

I will look more closely online for some optimization techniques