To optimize DAX queries that involve using more than one CALCULATE statement in Power BI, consider three major best practices: shifting focus from filter context interruption to concentration on reducing the expression complexity and lowering the data level.
Minimize filter context shifts: The CALCULATE function outlaws certain filters, which can greatly increase the processing burden. Many CALCULATE statements are not necessary, and the function tries to put in one CALCULATE all possible filters used in other CALCULATE statements. Thus, changing contexts is kept to a minimum, and all CALCULATEs do bolt well.
Simplify Expressions: Assess if every calculation being made in the expression is warranted. While intricate and nested CALCULATE DAX queries can, at times, be employed, many intermediate results aggregating essential details are simpler and clearer, with several calculations in between. This is not only easier to read but can also make some calculations quicker, as less complex expressions are usually quicker to compute.
Reduce Level of Detail in the Data: If your calculations do not require very detailed data (like calculating each single row), then try to do the calculations at a higher level before running CALCULATE. Taking aggregated values as opposed to the ones at the details level cuts down the amount of data worked on, hence reducing the speed of the calculations. For instance, process the data model to calculate it into appropriate summaries before carrying out CALCULATE to the raw data.
In this way, DAX queries with multiple CALCULATEs improve in performance, and Power BI becomes more user-friendly.