Forum Discussion
Append queries dynamically in Power Query
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
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
- ImkeF6 years agoCommunity Champion
Hi Alex_Ooi ,
instead of creating single queries for each of them, create a table with one row for each of them.
Then expand out the result column. No need to append anything.
Start from a table with parameters and add a column that grabs the data with a function.
- Alex_Ooi6 years agoHelper IV
Hi ImkeF thanks for your advice. I am stuck in two parts tho;
- What should I do once I have created a parameter? I left all default settings, and wrote "Sales_" as my current value in the parameters.
- What function(s) should I use to create a table with one row for each of the table, since #sections can't do the trick for me?
Looking forward to hearing from you. Thanks.