Forum Discussion
Is it possible to run code on PowerBI Desktop to get visual level metadata?
Hi everyone. I need to get metadata on my visuals in my reports, but not just the surface level stuff - I need visual types, where the data is coming from, and what filters are being applied (basically a text-based version of what the user is seeing but without the data itself). Between the PowerBI API, JavaScript, the embedded analytics playground, and the report.json files, I am able to get most of what I need. However, I am still unable to get filter information consistently/reliably. The last resort I have available is the PowerBI Desktop app. Are there ways in Python or Javascript (or others) to access how the data is being queried and filtered in the desktop app? Can I run code there or created some sort of automated process that can retrieve this information for me for my reports whenever I run it? If I can't run code on it directly, are there any other workarounds? Thank you!
yazdanb As I recall, SQL BI had a DAX script that returned all of the filters on a visual that I think you could implement as a tooltip. Displaying filter context in Power BI Tooltips - SQLBI
Hi yazdanb,
Thank you for reaching out to the Microsoft fabric community forum. Thank you Greg_Deckler, for your inputs on this issue.
After reviewing the details you provided, I have identified few workarounds that may help resolve the issue. Please follow these steps:
Limitations of Running Code Directly in Power BI Desktop: Power BI Desktop itself does not provide a built-in way to execute custom Python or JavaScript code directly within the application to extract visual-level metadata. Python scripts in Power BI can process data but do not have access to visual metadata. JavaScript is mainly for embedded analytics and does not work inside Power BI Desktop.
Using Power BI Performance Analyzer to Capture Queries (Manual Approach). The Power BI Performance Analyzer can track how data is being queried in Power BI Desktop, including filters applied. Open Power BI Desktop. Go to View → Performance Analyzer. Click Start Recording, then interact with visuals. Capture DAX Queries, which contain filter conditions. Extract and analyze the DAX code for filtering information.
Use Performance Analyzer to examine report element performance in Power BI Desktop - Power BI | Microsoft Learn
I hope this could resolve your issue, if you need any further assistance, feel free to reach out. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.
5 Replies
- Greg_DecklerCommunity Champion
yazdanb As I recall, SQL BI had a DAX script that returned all of the filters on a visual that I think you could implement as a tooltip. Displaying filter context in Power BI Tooltips - SQLBI
- v-kpoloju-msftCommunity Support
Hi yazdanb,
Thank you for reaching out to the Microsoft fabric community forum. Thank you Greg_Deckler, for your inputs on this issue.
After reviewing the details you provided, I have identified few workarounds that may help resolve the issue. Please follow these steps:
Limitations of Running Code Directly in Power BI Desktop: Power BI Desktop itself does not provide a built-in way to execute custom Python or JavaScript code directly within the application to extract visual-level metadata. Python scripts in Power BI can process data but do not have access to visual metadata. JavaScript is mainly for embedded analytics and does not work inside Power BI Desktop.
Using Power BI Performance Analyzer to Capture Queries (Manual Approach). The Power BI Performance Analyzer can track how data is being queried in Power BI Desktop, including filters applied. Open Power BI Desktop. Go to View → Performance Analyzer. Click Start Recording, then interact with visuals. Capture DAX Queries, which contain filter conditions. Extract and analyze the DAX code for filtering information.
Use Performance Analyzer to examine report element performance in Power BI Desktop - Power BI | Microsoft Learn
I hope this could resolve your issue, if you need any further assistance, feel free to reach out. If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.
Thank you for using Microsoft Community Forum.- v-kpoloju-msftCommunity Support
Hi yazdanb,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
- v-kpoloju-msftCommunity Support
Hi yazdanb,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.