Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Mokshi
Helper I
Helper I

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 editor looks like

 

 

1(1).png

 

Can anybody give an idea where to place or to replace my parameter name

Wanted to create a dynamic datasource in powerbi with parameter through odbc connector

pls explain

@PowerBI @PowerQueryFTW @powerqueryquest 

 

3 REPLIES 3
jennratten
Super User
Super User

Hello - based on your screenshot you can parameterize the database, table and possibly the DNS.

 

jennratten_0-1667469061205.png

 

Hello - 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.

 

jennratten_0-1667568215811.png

 

 

let
    Source = Odbc.DataSource("dsn=" & paramDsn, [HierarchicalNavigation=true]),
    database = Source{[Name = paramDb, Kind = "Database"]}[Data],
    data = database{[Name = paramTable, Kind = "Table"]}[Data]
in
    data

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors