Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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.
Solved! Go to Solution.
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.
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
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.
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
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 54 | |
| 51 | |
| 39 | |
| 15 | |
| 14 |
| User | Count |
|---|---|
| 93 | |
| 79 | |
| 37 | |
| 27 | |
| 25 |