cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rpeleg
Frequent Visitor

how can I get DAX query generated by power bi report?

Hi eb

I need to have a look at the full DAX query generated by power bi report (to get its data from underlying model).

Is there a 'show my DAX query' option in desktop?

If not is it hidden somewhere within the PBIX file?

I understand that looking at sql profiler will not cut it as DAX isnt registered over there but some kind of vertiPaq sql dialect??

TIA!

Rea

2 ACCEPTED SOLUTIONS
tjd
Impactful Individual
Impactful Individual

Okay, by that I guess you mean the query for measures and calculated columns?  One way to do that is to click on each measure in PowerBI and the formula will appear in the formula pane above the canvas or table.  The other way is to use DAX Studio and hook it up to your PowerBI Desktop pbix.  

View solution in original post

I wanted to generate a DAX query using a drag and drop interface and found SQL Serer Report Builder quite handy as you can generate the query using a drag and drop interface and then just copy the DAX and use it wherever you like. 

View solution in original post

14 REPLIES 14
JasonPad
New Member

Check this one in GitHub, it works great.

 

https://github.com/JasonPad19/PowerBIScanner/blob/main/README.md

natabird3
Continued Contributor
Continued Contributor

Actually if you go to View-> Performance Analyzer (in power bi dekstop) you can start recording and copy the dax from your visual and recreate in power bi report builder. This will copy all your measures and values, so its better in my opinion. 

The visual way folow the numbers 😀:

GETDAXQUERY.png

Phil_Seamark
Microsoft
Microsoft

Hi @rpeleg

 

SQL Profiler will work and you should be able to extract the DAX.  Do you have SQL Profiler installed and have you used it against a SQL Server Database engine?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Yeap got the profiler and worked with it.

I guess I got the wrong impression reading Performance Tuning of Tabular Models in SQL Server 2012 Analysis Services

especially around pages 26-28 where they show an example of profiling DAX that looks like some kind of strange SQL...

If we are looking at the same thing, I don't think that is DAX.  When using Profiler, remove all your events apart from Query Begin and Query End.  If the DAX is all you are after you won't need any other events.

 

 

trace.png


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

thanks a lot will check it out ASAP

tjd
Impactful Individual
Impactful Individual

Perhaps I'm missing something here.  Why not just open the Advanced Editor on the Query ribbon for each of your queries to see what they say?

rpeleg
Frequent Visitor

Thanks

I need DAX query generated by report not queries to model's data sources.

tjd
Impactful Individual
Impactful Individual

Okay, by that I guess you mean the query for measures and calculated columns?  One way to do that is to click on each measure in PowerBI and the formula will appear in the formula pane above the canvas or table.  The other way is to use DAX Studio and hook it up to your PowerBI Desktop pbix.  

View solution in original post

rpeleg
Frequent Visitor

I want the full EVALUATE() story.

Not just measures and formulas.

Would that be visible by the dax studio?

tjd
Impactful Individual
Impactful Individual

Not sure what you mean by the "full Evaluate() story".  I would suggest going to DAX Studio and reviewing how it works and what it shows to see if it answers what you're looking for.

rpeleg
Frequent Visitor

thanks a bunch!

DAX studio seems worth  a try.

I wanted to generate a DAX query using a drag and drop interface and found SQL Serer Report Builder quite handy as you can generate the query using a drag and drop interface and then just copy the DAX and use it wherever you like. 

View solution in original post

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors