Forum Discussion
Switch function
Hi Rocon
Using the Allselected function in the Calculate function does affect performance, especially when working with large data sets or complex calculations.
This is because Allselected retains all filters except those on the rows and columns of the table that uses it, which can lead to a lot of recalculations when the context changes.
ALLSELECTED function (DAX) - DAX | Microsoft Learn
You can try the following methods to improve performance:
Simplify the calculation logic as much as possible and make sure that only what is necessary is calculated.
If MEASURE is complex, consider using variables to store intermediate results.
Using variables in your DAX formulas can help you write more complex and efficient calculations. Variables can improve performance, reliability, readability, and reduce complexity.
Use variables to improve your DAX formulas - DAX | Microsoft Learn
If performance issues are indeed related to the use of Allsselected, please consider whether you need to use it in all cases.
Use the performance analyzer in Power BI Desktop to determine which visual objects or metrics take the longest to load.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much for your answer Nuno!
The thing is that the calculations is not that advanced but since I have YTD, YTD FC, YTD LY, Month etc it seems like it takes a lot of the performance. I have a measure like this where I use ALLSELECTED but when I remove the ALLSELECTED from the formula, no value is being displayed:
- Anonymous2 years agoNot applicable
Hi Rocon
Can you provide detailed sample pbix file and the results you expect.So that I can help you better. Please remove any sensitive data in advance.
Regards,
Nono Chen