Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
yazdanb
Frequent Visitor

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!

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community 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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-kpoloju-msft
Community Support
Community 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 | Micr...

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.

View solution in original post

5 REPLIES 5
v-kpoloju-msft
Community Support
Community 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 | Micr...

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.

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.

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.

Hi @yazdanb,


I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

Greg_Deckler
Community Champion
Community 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



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.