Forum Discussion
Anonymous
3 years agoNot applicable
Need guidance to create a dynamic data source in powerbi
I wanted to create a dynamic datasource with parameter in powerbi My data is connected from mongodb through odbc connector. And I created my parameter name as "parameter". Here is what my advance e...
Anonymous
3 years agoNot applicable
jennratten
Super User
3 years agoHello - please try this sample below. You will need to swap out the highlighted text with the names of your actual parameters. If your parameter names don't include special characters/spaces then you don't need to add any other characters, otherwise, you will need to wrap your parameter names like this #"param name". I changed the text before the = sign for the database and table so that they would be applicable in various scenarios. For example, if your parameter gets values from the food database instead flowers, it would be preferable for the name to not include a reference to flowers.
let
Source = Odbc.DataSource("dsn=" & paramDsn, [HierarchicalNavigation=true]),
database = Source{[Name = paramDb, Kind = "Database"]}[Data],
data = database{[Name = paramTable, Kind = "Table"]}[Data]
in
data