Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Any method to replace usage of multiple SWITCH function in a measure?

Hello experts,

I would like to seek for help to improve the performance of dashboard. Where I have a complex scenario to achieve and required to apply multiple Switch funtion in a single measure.
The measure looks like this:

Var a = SelectedValue(ColumnA)
Var b = SelectedValue(ColumnB)
Var c = SelectedValue(ColumnC)

Return SWITCH(a,"SampleA",SWITCH(b,"SampleB",SWITCH(TRUE(),......)
However due to multiple Switch funtion used, thus the performance is slow at the moment.

Any idea to re-structure the measure to achieve same result?

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    It is a little difficult to get the solution base on your provided info. Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

     

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

     

    In addition, you can refer the following links to try to solve your problem...

    DAX Best Practice Guide

    Optimizing DAX Video Course

    Use Performance Analyzer to examine report element performance (can see and record logs that measure how each of your report elements performs when users interact with them, and which aspects of their performance are most (or least) resource intensive.)

    Best Regards