I am trying to call a table in Power Query M dynamically. I have created a simple query below to explain what I am trying to do.
I'd like the result to be "It Worked" as opposed to "Source1" which is what I currently get.
let
Source1 = Table.FromList(
{
[Word1="It",Word2="Worked"]
},
Record.FieldValues,
{"Word1","Word2"}
),
Source2 = "Source" & "1"
in
Source2
Use Case Details:
I am trying to do this so that I can call a query based on conditions. such as:
if ENV = "production" then
Customer_s
else
Customer_m
Where Customer_s
is a query to retrieve customer data found in a CSV file and Customer_m
is a query to retrive customer data found on a SQL Server.
Because I will be doing this with many tables (not just customer) I thought I'd create a function where you can pass in the model name (ie "Customer") and it would then string it together to call the query.
I just find that PowerBI grinds to a halt and constantly reruns queries unnecessarily which is killing my PC and network speed. I thought an easy way around this would be to create dummy data that looks like the result of SQL Server but is stored locally on my machine. That way I can also write queries if I don't have access to the internet.
If you use this:
= Expression.Evaluate("Source"&"1", #shared)
you can dynamically reference other queries. But not other steps in the same query (as it seems). So it has to sit in a new query.
Or was your question about:
Text.Combine({"It", "Worked"}, " ")
?