參考答案
If a report runs slowly, I first try to isolate where the delay is coming from instead of immediately rewriting code.
I start with Performance Analyzer in Power BI Desktop. I record a refresh and check how long each visual takes. Power BI breaks it down into DAX query time and visual rendering time. If the DAX query takes most of the time, the issue usually lies in the data model or measures. If rendering is slow, the visual may be pulling too much data or using complex interactions.
Next, I check the data model. I look for unnecessary columns in large fact tables and remove any that are not used in visuals or calculations. I also verify data types; for example, IDs stored as text instead of integers increase memory usage. If Auto Date/Time is enabled while I already have a proper date table, I disable it to avoid hidden tables expanding the model.
Then I review the DAX measures used in the slow visuals. If I see iterators like SUMX or COUNTX over large tables, I evaluate whether a simple aggregation like SUM or COUNT would work. Iterators often shift more work to the formula engine, which becomes expensive at scale. I also simplify CALCULATE expressions by using direct column filters instead of complex FILTER() logic wherever possible. Using variables (VAR) helps avoid recalculating the same expression multiple times.
After that, I check the storage mode. If the model uses DirectQuery, every interaction sends queries back to the source system, which increases latency. If the dataset allows it, I switch to Import mode for better performance. In larger systems, I design a composite model with imported aggregation tables for summaries and DirectQuery only for detailed drillthrough.
I also review Power Query to ensure query folding still works. If transformations break folding early, Power BI processes more data locally than necessary, increasing refresh time and memory load.
If performance is still an issue, I use DAX Studio to analyze server timings and understand how much time the storage engine versus the formula engine consumes. That usually tells me whether the bottleneck is model design or DAX logic.
That's the approach I follow: isolate the bottleneck, optimize the model, simplify calculations, and choose the right storage architecture.