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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
olegkazanskyi
Helper II
Helper II

XMLA dataset tables created with dataflow do not have M code

We want to pull M code from Power BI Service to get information that we can't with using API, like a specific stored procedure used in a table, all appends and merges etc.

 

This code shows all dataset M Queries

select * from
$system.discover_m_expressions

 

But when I run it for a dataset built completely from dataflows, it doesn't show anything!

Is it a bug?

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Hi,

That returns any shared expressions in M which I thought were things like parameters and functions.

 

In tabular for modern data sources like data flows the M expressions are stored in the table partition which can be accessed with:

 

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!!

View solution in original post

5 REPLIES 5
bcdobbs
Community Champion
Community Champion

Hi,

That returns any shared expressions in M which I thought were things like parameters and functions.

 

In tabular for modern data sources like data flows the M expressions are stored in the table partition which can be accessed with:

 

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!!

It works!

Thank you!

No problem, I've learnt something new there so thank you!

 

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!!

You literally changed my life today! 

I wondered where all these requests come from, now I know!

I will dig deeper!

 

Big kudos!

bcdobbs
Community Champion
Community Champion

If you open your XLMA end point in tabular editor you can see the struture:

 

bcdobbs_0-1638901034658.png

and then the data source M is in the tables Partition:

bcdobbs_1-1638901099938.png

 



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!!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors