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
pabeader
Post Patron
Post Patron

Is there a way to expose the table name in Power Query?

I have 50+ tables that I need to include the name of, as a column in the table.  I would rather not go the 'add a custom column with the name of the table '  route.  

I thought there would be something like Table.Name that I could use, but I sure can't find it.

 

 

This doesn't work:

Text.Combine({Text.From([EAREA], "en-US"), Text.From([ENUMBER], "en-US"),Text.From([Table.Name], "en-US")}, "-")  

 

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

As @lbendlin mentioned, the key is to use #shared in your query.  Here is some M code to give you a list of tables in the current model.

let
Source = #shared,
#"Converted to Table" = Record.ToTable(Source),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Value.Is([Value], Table.Type)),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true))
in
#"Filtered Rows"

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @pabeader ,

 

Please check if the method @mahoneypat provided could meet your requirements. 

And this blog explains in detail: Get List of Queries in Power BI - RADACAD.

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mahoneypat
Microsoft Employee
Microsoft Employee

As @lbendlin mentioned, the key is to use #shared in your query.  Here is some M code to give you a list of tables in the current model.

let
Source = #shared,
#"Converted to Table" = Record.ToTable(Source),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Value.Is([Value], Table.Type)),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = true))
in
#"Filtered Rows"

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


lbendlin
Super User
Super User

@ImkeF  has answered that question a while back.

 

Is there a way to get a table name in Power Query? (microsoft.com)

I read that and that is exactly what I don't want to do.  Assume that I have no idea what the table names are going to be.  I need some way to get the table name from the object itself.

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.

Top Kudoed Authors