Forum Discussion
DJPrometheus
5 years agoMicrosoft Employee
Reflexive Table Reference
Can a table in a Power Query/M reference itself? E.g. populate a column with the name of the current table through Add Custom Column?
- 5 years ago
No DAX is involved at all. This is the Power Query language M.
The code I gave is what you would use in the Advanced Editor to define your combined query. The whole thing would look something like this:let Source = Table.FromColumns({{#"BMX Bikes", #"Mountain Bikes", #"Hybrid Bikes"}, {"BMX Bikes", "Mountain Bikes", "Hybrid Bikes"}}, {"Table", "ItemType"}), #"Expanded Table" = Table.ExpandTableColumn(Source, "Table", {"Serial", "Status", "Shipped"}, {"Serial", "Status", "Shipped"}) in #"Expanded Table"
DJPrometheus
5 years agoMicrosoft Employee
That worked perfectly - I'll accept it as a solution, but I am curious how the table combination part works? Is there a good blog article on this?
- AlexisOlson5 years agoSuper User
I don't know of any related blog articles but it's just an application of the Table.FromColumns function (combined with a few years of experience with M).
Here's the documentation for that function:
https://docs.microsoft.com/en-us/powerquery-m/table-fromcolumns