Forum Discussion
How to make a variable in connection string?
- 9 years ago
Hi,
I don't thnik I am skilled enough to find the right solution. I might decide to just use Power BI for historical data. Data I will manually upload once a week. It only takes a few minutes each time.
I already have a real-time solution running at Klipfolio that works great. I will just add the klipfolio dashboard in an iFrame on my Sharepoint online portal.
Thanks for asking and thanks all for your input.
Kind regards
Morten
Unless I am mistaken, you want to create Parameters in the Query Editor.
- mushama9 years agoRegular Visitor
Maybe you can tell me - I have absolutely no idea of what is the right way to do it.
So, if you have any good suggestion of a syntax you would be hero of the day if sharing it with me :-)
- Greg_Deckler9 years ago
Community Champion
Sure, in this example, I have a parameter called "File". I have two options set for this parameter, "datasource1.csv" and "datasource2.csv". The "M" code looks like this:
let Source = Csv.Document(File.Contents("c:\temp\powerbi\" & File),[Delimiter=",", Columns=2, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Promoted Headers" = Table.PromoteHeaders(Source), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Category", type text}, {"Value", Int64.Type}}) in #"Changed Type"You can learn more about parameters here:
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/
- v-qiuyu-msft9 years ago
Community Support
Hi mushama,
In addition to Greg_Deckler's suggestion, you can also take a look at the sample of Scenario 1: Parameterising a Data Source in this article.
Best Regards,
Qiuyun Yu- mushama9 years agoRegular Visitor
Thank you - I just took a quick look at the article. It looks promising and I will have time to verify if I can use the solution during the next couple of days.
I will let you know wheter it worked or not.
Kind regards
Morten