Getting Report Visual IDs With Power BI Desktop Developer Mode

Back in 2021 I wrote a post showing how you can link a DAX query generated by a Power BI report in Log Analytics to a visual in a Power BI report. In that post I showed how you can get the unique IDs for each visual in a report using Performance Analyzer, an approach which works but has drawbacks. Then, in 2022 I wrote another post showing how you can get the same IDs using the Power BI Embedded Analytics Playground, which again works but isn’t perfect. After that, this August, my colleague Rui Romano pinged me on Teams to point out that the new Power BI Desktop Developer Mode and the .pbip file format provides the best and easiest way to get these IDs.

If you do save a Power BI report in .pbip format, look in the report folder and open the report.json file (where the report definition is stored) with a tool like Visual Studio Code then you can find the IDs for visuals quite easily. The sections array lists all the pages in the report; the visualContainers array within that lists all the visuals on a page; and the visual’s ID can be found in the config property as its name:

As a result, if you’re looking in Log Analytics and you need to understand which visual a query was generated by, you can just copy the ID from the ApplicationContext column of a QueryEnd event and search for that ID in the report.json file. Even when you’ve found that ID, though, it can be hard to know which visual it relates to. This is where a tool I blogged about a few weeks ago, PBI Inspector, comes in handy: as part of its output it draws wireframes of each report page showing each visual, its type and its ID. Here’s the report page from the example above, with two visuals on it, and the associated PBI Inspector wireframe:

Yet another way in which Power BI Developer Mode makes our lives better!

2 thoughts on “Getting Report Visual IDs With Power BI Desktop Developer Mode

  1. The .pbip method is easy, but manual. If you need to automate something, here’s method #4… You can also use Stephanie Bruno’s Power BI Field Finder tool (https://github.com/stephbruno/Power-BI-Field-Finder). It’s a Power BI template. You give it a report folder path, and it gets all the visual metadata from the Power BI files and like PBI Inspector, shows the visual wireframes. Part of what I like about this tool is you can copy the Power Queries that get the metadata and paste them into Excel, allowing you to integrate the info into whatever your dev process needs. Of course, you could recreate the wheel using the .pbip json, but Stephanie has already done the heavy lifting here.

Leave a Reply