Performance always is an issue, isn’t it? Throughout a career that wandered through IIS (My web pages are slow), SharePoint (My web parts/lists/search queries/indexes are slow), SQL Reporting (My SSRS reports/stored procedures/excel pages are slow) and now Power BI (My visuals are taking forever to load), troubleshooting slow performance is always a big part of what I do.
Troubleshooting Power BI visuals can be a little tricky. There aren’t any obvious dials or gauges to look at, you can’t spin up perfmon and attach it to Power BI desktop and the logs, while impressive looking, won’t help you narrow in on the poorly written measure that is killing your performance. What I am going to layout next is a quick approach that you can take to not only get a good look at the performance of a report page but how also you can narrow in on the measures that are dragging you down.
Quick Setup Note – I am using the customer profitability sample from Microsoft for my PBIX file. Its visuals load super quickly but its a quick and easy download here.
First things first, your reports and data model need to be in the same PBIX. We will be using Dax Studio to connect to the data model and run a trace so everything we are testing needs to be in the same PBIX. If you have your visuals and data model in separate PBIX files, you will need to recreate your visuals in the PBIX where your data model live.
Create a blank report page. Power BI desktop will load visuals on the report page that it opens when you open the PBIX so in order to capture a true idea of the page performance, you need to create a blank report page and save the PBIX with that page active.
Close and reopen your PBIX file. If you did step one, you should be looking at a blank report page.
Open Dax Studio and the ‘Connect’ screen should open. Select your open PBIX dpcument as shown and select ‘connect‘.
Once connected, click on the ‘All Queries’ button in the ribbon. This actually starts a trace on your SSAS instance that is running in Power BI desktop. Once the trace is ready, you will see ‘Query Trace Started’ in the output window.
Return to your PBIX that you have open in Power BI desktop. Click on the report tab that you wish to trace and let the page fully load. Once the page loads, you can stop the trace by returning to DAX Studio, choosing the ‘All Queries’ tab and selecting the stop button.
Once the trace is stopped, click on the duration column header to sort the queries by duration. As I mentioned earlier, this demo is super fast so the ‘slowest’ query took 21ms but hopefully you get the point. You know have a list of queries that were performed to build your page, along with the time it took to execute each of the queries.
Continuing on, double click on the query text in the ‘Query’ column. The actual code used will show up in the editor section above the output section. Now you can analyze the DAX being called as well as run an individual trace to dig in deeper.
At this point, you can run all of the DAX in the editor or you can highlight and run just sections of it, just like normal in DAX Studio. If you enable the Query Plan and Server timings options, you can capture a trace and see the actual queries that are being passed to the formula and storage engine for processing. Enabling the query plan option does just what it says, it gives you the query plans, both physical and logical, that were chosen to run the queries.
I have a long animated GIF below that shows turning on the query plan and server timings options, setting the ‘Run’ option to flush the cache each time I run a query, then running the query. I then show where you can find the query plan and server timings information. Since I got the whole screen in the GIF, its a pretty lousy resolution but perhaps if you open it in another tab, you can see enough detail.
Questions, comments, suggestions on digging deeper into Power BI visuals/reports performance? Throw me a comment or hit me up on Twitter – @szBigDan.