Forum Discussion
Refer to current Query Name in formula
- 8 years ago
Hi,
To my knowledge, a query can't refer to its own name directly.
But I think you can achieve what you're trying to do using the Expression.Evaluate function, as long as you have a way of coming up with a list/table containing the table names as text values.
Here's an idea which could be a starting point.
If you store the names of two tables to be appended in Table1Name and Table2Name, then this expression will append those two tables:
Expression.Evaluate( Table1Name, #shared ) & Expression.Evaluate ( Table2Name, #shared )
or alternatively
Expression.Evaluate( Table1Name & " & " & Table2Name, #shared )
You could have a table with rows containing the pairs of table names, and use Expression.Evaluate within a custom column.
Anyway, that may be useful in some way.
Regards,
Owen
- 3 years ago
You can use #sections in Power Query to find the list of table names, and refer to it dynamically. Solved!
--------------------------------------------------
@ me in replies or I'll lose your thread
Master Power Query M? -> https://powerquery.how
Read in-depth articles? -> BI Gorilla
Youtube Channel: BI Gorilla
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.
You can use #sections in Power Query to find the list of table names, and refer to it dynamically. Solved!
--------------------------------------------------
@ me in replies or I'll lose your thread
Master Power Query M? -> https://powerquery.how
Read in-depth articles? -> BI Gorilla
Youtube Channel: BI Gorilla
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.
- ManoukUBN2 years agoFrequent Visitor
A step-by-step on how to do this: Get List of Queries in Power BI - RADACAD
- Anonymous2 years agoNot applicable
I am encountering an issue with this in that #sections only exists within the power query editor. When I append the tables using expression.evaluate on the query created with #sections, it is fine within the editor, but upon closing and loading, it throws an error for trying to convert from null to table.
Have you found a way around this when using #sections?