Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I've used the parameters a lot, to change the source from a dev to prod database for example.
Now I need a bit more complex situation
The dev database is in dataflows, the prod is in datalake.
This makes the steps to read from the source different, it's not a single source reference to change, multiple steps need to change.
Like:
if pSource = 'dev' then
Source = #"SourceFiles",
#"Filtered Rows" = Table.SelectRows(Source, each [Name] = "SourceFile.csv"),
Content = #"Filtered Rows"{0}[Content],
#"Imported CSV" = Csv.Document(Content,[Delimiter=",", Columns=91, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true]),
else
Source = PowerBI.Dataflows(null),
#"WorkspaceID" = Source{[workspaceId="1234abcd"]}[Data],
#"DataflowID" = #"WorkspaceID"{[dataflowId="abcd1234"]}[Data],
#"FileToRead" = #"DataflowID"{[entity="SourceFile"]}[Data]
anyone has suggestions how to implement this?
Thanks,
Johan
Solved! Go to Solution.
Make 2 queries, both set to not load to model. Then add one more query that does the ife
if pSource = "dev" then
DevQuery
eles
ProdQuery
Note: the security model will require you to sign into both
Hello @Johan
write the query like this
ReadDataSource = if pSource = 'dev' then
let
Source = #"SourceFiles",
#"Filtered Rows" = Table.SelectRows(Source, each [Name] = "SourceFile.csv"),
Content = #"Filtered Rows"{0}[Content],
#"Imported CSV" = Csv.Document(Content,[Delimiter=",", Columns=91, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true])
in
#"Promoted Headers"
else
let
Source = PowerBI.Dataflows(null),
#"WorkspaceID" = Source{[workspaceId="1234abcd"]}[Data],
#"DataflowID" = #"WorkspaceID"{[dataflowId="abcd1234"]}[Data],
#"FileToRead" = #"DataflowID"{[entity="SourceFile"]}[Data]
in
#"FileToRead"
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @Johan
write the query like this
ReadDataSource = if pSource = 'dev' then
let
Source = #"SourceFiles",
#"Filtered Rows" = Table.SelectRows(Source, each [Name] = "SourceFile.csv"),
Content = #"Filtered Rows"{0}[Content],
#"Imported CSV" = Csv.Document(Content,[Delimiter=",", Columns=91, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(#"Imported CSV", [PromoteAllScalars=true])
in
#"Promoted Headers"
else
let
Source = PowerBI.Dataflows(null),
#"WorkspaceID" = Source{[workspaceId="1234abcd"]}[Data],
#"DataflowID" = #"WorkspaceID"{[dataflowId="abcd1234"]}[Data],
#"FileToRead" = #"DataflowID"{[entity="SourceFile"]}[Data]
in
#"FileToRead"
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Make 2 queries, both set to not load to model. Then add one more query that does the ife
if pSource = "dev" then
DevQuery
eles
ProdQuery
Note: the security model will require you to sign into both
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |