Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello all,
Also @MarcelBeug , @Kimcha
I've seen a 2 year old thread that touches on this issue and haven't been able to connect, so am putting it into play again. Here goes and any help is appreciated
I would like to create "conditional" Source statements....
let
SourceMachine1 = Csv.Document(File.Contents("C:\Users\Mach1\Models\DataLoad\BigFile.csv"),[Delimiter=",", Columns=24, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers1" = Table.PromoteHeaders(SourceMachine1),
SourceMachine2 = Csv.Document(File.Contents("C:\Users\Mach2\Models\DataLoad\BigFile.csv"),[Delimiter=",", Columns=24, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers2" = Table.PromoteHeaders(SourceMachine2),
//pick the machine with a parameter, use_No1 (either true of false)
#WhichToUse = if use_No1 then #"Promoted Headers1" else #"Promoted Headers2"
//------>then the rest of the query which is all the same for both machines
#"Renamed Columns" = Table.RenameColumns(#"WhichToUse",{{"UniformName", "ClientName"}, {"TFCB", "Beds"}, {"UHN", "FACIL(ReptID)"}}),
#"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each ([RankReptRecFYs] = 1) and ([ReptVersion] = "Current"))
in
#"Filtered Rows"
Is that remotely correct? So how do I feed in the parameter that I've called use_No1? Do I have set it in the query itself or can it tell what machine it's on?
Solved! Go to Solution.
You may invoke custom function in If expression.
https://community.powerbi.com/t5/Desktop/Create-tables-based-on-all-Query-Parameters/td-p/345947
Hello all,
It turns out that Power BI has a very useful ability to change data sources in a flash. It was extremely helpful and I've chosen not to mess with my queries as a result.
If you go to File->Options and settings->Data source settings you'll be presented with a summary of all of your data sources in that model and an ability to easily and quickly change the sources of all of the queries connected to each one. The change sources button presents a dialog box with basic and advanced options. It was really simple and fast to do what I needed to do. Change the file path and hit OK. The advanced tab has more options for adding to a source string.
Cheers! Tom
You may invoke custom function in If expression.
https://community.powerbi.com/t5/Desktop/Create-tables-based-on-all-Query-Parameters/td-p/345947
Hello all,
It turns out that Power BI has a very useful ability to change data sources in a flash. It was extremely helpful and I've chosen not to mess with my queries as a result.
If you go to File->Options and settings->Data source settings you'll be presented with a summary of all of your data sources in that model and an ability to easily and quickly change the sources of all of the queries connected to each one. The change sources button presents a dialog box with basic and advanced options. It was really simple and fast to do what I needed to do. Change the file path and hit OK. The advanced tab has more options for adding to a source string.
Cheers! Tom
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 63 | |
| 55 | |
| 42 | |
| 41 | |
| 23 |
| User | Count |
|---|---|
| 171 | |
| 136 | |
| 119 | |
| 79 | |
| 54 |