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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Scan dataset M codes.

We want to scan datasets M codes using XMLA endpoint to get information on how tables have been created.
We found that we can do this for tables created from Excel, SQL, manual inputs.
But the tables created from dataflow are not shown in the list of M Queries.

 

I use this command to request M codes:
select * from
$system.discover_m_expressions

5 REPLIES 5
bcdobbs
Community Champion
Community Champion

I think my solution on this post might help:

 

https://community.powerbi.com/t5/Service/XMLA-dataset-tables-created-with-dataflow-do-not-have-M-cod...

 

You need to access the M code from the table partitions:

 

SELECT *
FROM $SYSTEM.TMSCHEMA_PARTITIONS



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

@bcdobbs  This is aweome to say the least !!! Fantastic !!! Thanks for sharing. 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
bcdobbs
Community Champion
Community Champion

All sorts of fun available...

 

Following code gives you list of all those queries:
SELECT * FROM $System.DBSchema_Tables
WHERE TABLE_TYPE = 'SCHEMA'
ORDER BY TABLE_NAME ASC

 

which is from Dynamic Management Views (DMVs) in Analysis Services | Microsoft Docs



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
AlexisOlson
Super User
Super User

Are you expecting to retrieve the M code that generates the dataflow or just some M code that connects to the dataflow? I don't think the former exists within a Power BI dataset.

@AlexisOlson  OP is referring to this

https://www.fourmoo.com/2021/11/24/how-did-i-keep-my-power-bi-dataset-measures-documented-and-up-to-...

 

@Anonymous  "But the tables created from dataflow are not shown in the list of M Queries" - yes it does not work there. I have tested it and I guess the only tables that show up there are the ones exclusively created through M.

 

There isno DMV there.

 

smpa01_0-1638897608757.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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