Forum Discussion
Append queries dynamically in Power Query
I have never worked with Expression.Evaluate before in Power Query. Can you share more with me? Do I add this step at the end of my query or something? I've read the documentation you linked me, but I still don't quite grasp how does that help in the situation here. Any detailed guide is much appreciate. Thank you so much already, AlB
You do not actually need it Expression.Evaluate. It would be complicating things unnecessarily. You can just use #sections to get the list of all queries, filter out the ones you don't want and then combine (append) the remaining ones to get the final result. This example selects and appends all queries whose name starts with "Table1":
let
Source=#sections,
Section1 = Source[Section1],
#"Converted to Table" = Record.ToTable(Section1),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each Text.StartsWith([Name], "Table1")),
res = Table.Combine(#"Filtered Rows"[Value])
in
res
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
- Alex_Ooi6 years agoHelper IV
I had a reply from Reza, this is what he said:
"This method only works inside the Power Query Editor. the environments of #shared and #sessions are not available when you load data into Power BI."
It is such a shame the solution could work, but unfortunately it isn't yet what I want.
- AlB6 years agoCommunity Champion
perhaps ImkeF , Mariusz , edhans , Greg_Deckler can provide some wisdom here