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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JVDW_VSH
Frequent Visitor

Extract measure names from report.json (via save as .pbip)

I have a report that is build on a XMLA semantic model.

I have saved this report as .pbip file and now can see the details of the report in the report.json file that is generated, including all the measures that are used in the report. 

I loaded this report.json file in a new blank power bi file, but I'm struggling to retrieve all the measure names from the json file.

 

I know there is a tool Measure killer, but unfortunately that is not an option in my situation. 

I can't use DAX studio DMV either, because the semantic model contains more measures than used in my report and I am only interested in the measures that are used in my report.

(the other way around would be great as well to see the measure that are in the semantic model, but are not used in my report, but that step shouldn't be too difficult if I have the measures used in the report and all measures in the semantic model.)

 

Any suggestions on how to attack this?

6 REPLIES 6
Brunner_BI
Super User
Super User

Measure Killer will also show you the report-level measures.

Additionally you will see which ones are used and which are not.

The same is true for the measures and calculated columns that belong to the semantic model.

 

Why can you not use this tool? @JVDW_VSH 

------------------------------------
Brunner BI focusing on Microsoft Power BI development and consulting
Developers of external tool "Measure Killer"
My blog
JVDW_VSH
Frequent Visitor

Thanks for your response, @rajendraongole1 

This is what I thought as well. Unfortunately it is not so easy to identify the measures :-(.
I did load the report.json, searched all the options and figured the measures are within the sections list.

I clicked this list and converted it to a table and just by searching the columns found my measures are found in the config or filters column. But they are in a long, difficult to read format and also so long that the text is cut off at a certain point...

Can you please elaborate a little more on how to extract the measure names from that point?

 

Thanks!

Hi @JVDW_VSH -Go to Home > Advanced Editor in Power Query and paste the following M code to create a custom function. This function will help to search for any text that resembles a measure name within the config or filters text fields.

 

// Custom function to extract measure names from a long text field
(TextField as text) as list =>
let
// Define a pattern to match common measure name syntax
MeasurePattern = Text.Select(TextField, {"a".."z", "A".."Z", "0".."9", "_", " "}),
// Split text by spaces, line breaks, or any other delimiters if needed
SplitText = Text.Split(TextField, {" ", ",", ";", "(", ")", "[", "]"}),
// Filter only those parts of the text that match a measure-like pattern
PossibleMeasures = List.Select(SplitText, each Text.Contains(_, "MeasureNamePattern")), // Replace with actual pattern if needed
// Remove duplicates if measure names are repeated
UniqueMeasures = List.Distinct(PossibleMeasures)
in
UniqueMeasures

 

After creating this function, you can apply it to each row in the config or filters columns.

Add a new Custom Column in Power Query and call this function on each row of the config or filters column

 

ExtractedMeasures = ExtractMeasures([config])

 

This will produce a list of possible measure names for each row.

Expand the Extracted Measures:

Expand the new column containing lists of measure names to see all measures used in the report.
Filter out any irrelevant entries or duplicates.

 

i have followed sometime back using the pq editor script , pelase check and let know





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thanks @rajendraongole1 , this feels like a good direction.

I do get an error on invoking the function though.
I'm not much of an M-expert, but it looks like the steps don't work because of a type issue. The column I have is of a field type Text and I'm not sure that can be converted to a list?


darkniqht
Advocate I
Advocate I

To extract measure names from your report.json file, you can use a JSON parser or a script in a language like Python.

 

Start by loading the report.json file, then navigate through the structure to find the measures section.

 

Look for keys like "measures" or similar, and extract the names from there.

 

If you're comfortable with programming, using a simple script can make this easier.

 

Alternatively, if you prefer a no-code solution, you could copy the JSON content into an online JSON viewer, which allows you to explore the structure visually and find the measure names.

 

Once you have the list of measures used in your report, you can compare it with your semantic model to identify any unused measures.

rajendraongole1
Super User
Super User

Hi @JVDW_VSH -You’re on the right track by working with the .pbip file and the report.json. Since you're interested in isolating the measure names used in your report, we have another approach using Power Query within Power BI that might help extract this data

 

Open Power BI Desktop and go to Home > Get Data > JSON.
Select and load your report.json file.
This will open the JSON structure in Power Query. Each level of the JSON will be represented as nested tables.
Step 2: Navigate to the Measures Section
Expand the JSON hierarchy to locate where the measures are defined. In the Power BI JSON report file, measures are typically found under sections, visuals, or objects depending on the structure.
Look for any key indicating a measure or expression, as these entries will hold the measure names and expressions used in your report.
Step 3: Extract Measure Names
Once you’ve identified the location of the measures within the JSON hierarchy, select that table or list.
Use Expand to bring out the fields where the measure names are stored.
Filter to only retrieve the name or displayName fields if available, to get a clean list of measure names.
Step 4: Load Data into Power BI
After isolating the measure names, click Close & Apply in Power Query to load this list into your Power BI report as a new table.

 

or another approach is using Python to Extract Measures

 

Hope this process helps you to give the list of measures.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.