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
Powerbinewguy20
New Member

Query Source Table Name

Hi Everyone,

 

I was wondering if anyone knew a way to get the source Table Name from a query using a SQL server source. What I'm trying to do is filter another query based on the source table name from the first query using power query functions or m code.

 

Is there some kind of property that would return the source table name for a given query? Or some other creative way to get the name?

 

Any help would be appreciated and I thank you in advance.

1 ACCEPTED SOLUTION
NaveenGandhi
Super User
Super User

Hi @Powerbinewguy20 

Below M code will give you  the table name.

let
Source = Sql.Databases("Seneca"),
TableName = Table.ToRecords(Source){0}[Name]
in
TableName

Below is the source step.

NaveenGandhi_0-1723652669520.png

 

NaveenGandhi_1-1723652747612.png

 


Let me know if this helps.
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

Follow me on LinkedIn!!!


LinkedIn

View solution in original post

1 REPLY 1
NaveenGandhi
Super User
Super User

Hi @Powerbinewguy20 

Below M code will give you  the table name.

let
Source = Sql.Databases("Seneca"),
TableName = Table.ToRecords(Source){0}[Name]
in
TableName

Below is the source step.

NaveenGandhi_0-1723652669520.png

 

NaveenGandhi_1-1723652747612.png

 


Let me know if this helps.
If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

Follow me on LinkedIn!!!


LinkedIn

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.