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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Dev_003
Regular Visitor

Parameterized data source (Azure Databricks) connection with the powerBI.

Hello Team,
Hope every one is doing great!

 

I am finding a way to parameterized multiple connnections(dev, test, stage, prod) of Azure databricks with the power bi desktop, I found we can set the parameter for sql server and after that user can have the dropdown option while choosing the connection(server and database), but its not working same when we choose the Azure Databricks connection.
Can team help me resolving/ guilding on this scenario.
Also, Is there possibility to make SQL Query (Direct Query) and power query parameterized?

Thank You

1 ACCEPTED SOLUTION

Hi @Dev_003 ,

You can follow the steps below to get it:

1. Create a query parameter 'P_StudyID'

vyiruanmsft_1-1728637389653.png

2. Update the above codes as below: you can refer this thread

= Value.NativeQuery(
Databricks.Catalogs(Host, HttpPath, [Catalog=Catalog, Database=null, EnableAutomaticProxyDiscovery=null]){[Name=Catalog, Kind="Database"]}[Data],
"SELECT rs.ID, " &
"rs.Name AS siteName, " &
"sub.SubjectID, " &
"sub.SubjectIdentifier, " &
"subStatus.Status_ID, " &
"subStatus.Name AS StatusName, " &
"sub.Study_ID " &
"FROM " & Catalog & "." & Database & ".instance__subject sub " &
"JOIN " & Catalog & "." & Database & ".instance__status subStatus " &
"ON sub.Status_ID = subStatus.Status_ID " &
"JOIN " & Catalog & "." & Database & ".instance__site rs " &
"ON sub.Site_ID = rs.Site_ID " &
"WHERE sub.Disabled = FALSE " &
"AND sub.Study_ID  ="&P_StudyID&" ",
null,
[EnableFolding=true]
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Dev_003
Regular Visitor

Thank You @v-yiruan-msft for the explanation, in case of Azure Databricks data source connection parameter i have created but it has to be change manually in the power bi service by admin to point to different environment.

I still have doubt regarding the native query parameterization, it will be really appreciable if this doubt resolves.

Here is the scenario, i have written power query mentioned below, where i have hardcoded the Study_ID  in the where clause, but in production/other environments, it should be parameterised and the studyid comes as the query parameter from the web application where the power bi report is embedded. How this issue be resolved in secure manner.
Catalog, Host, HttpPath is parameterised one.

= Value.NativeQuery(
Databricks.Catalogs(Host, HttpPath, [Catalog=Catalog, Database=null, EnableAutomaticProxyDiscovery=null]){[Name=Catalog, Kind="Database"]}[Data],
"SELECT rs.ID, " &
"rs.Name AS siteName, " &
"sub.SubjectID, " &
"sub.SubjectIdentifier, " &
"subStatus.Status_ID, " &
"subStatus.Name AS StatusName, " &
"sub.Study_ID " &
"FROM " & Catalog & "." & Database & ".instance__subject sub " &
"JOIN " & Catalog & "." & Database & ".instance__status subStatus " &
"ON sub.Status_ID = subStatus.Status_ID " &
"JOIN " & Catalog & "." & Database & ".instance__site rs " &
"ON sub.Site_ID = rs.Site_ID " &
"WHERE sub.Disabled = FALSE " &
"AND sub.Study_ID = 111111",
null,
[EnableFolding=true]
)

Hi @Dev_003 ,

You can follow the steps below to get it:

1. Create a query parameter 'P_StudyID'

vyiruanmsft_1-1728637389653.png

2. Update the above codes as below: you can refer this thread

= Value.NativeQuery(
Databricks.Catalogs(Host, HttpPath, [Catalog=Catalog, Database=null, EnableAutomaticProxyDiscovery=null]){[Name=Catalog, Kind="Database"]}[Data],
"SELECT rs.ID, " &
"rs.Name AS siteName, " &
"sub.SubjectID, " &
"sub.SubjectIdentifier, " &
"subStatus.Status_ID, " &
"subStatus.Name AS StatusName, " &
"sub.Study_ID " &
"FROM " & Catalog & "." & Database & ".instance__subject sub " &
"JOIN " & Catalog & "." & Database & ".instance__status subStatus " &
"ON sub.Status_ID = subStatus.Status_ID " &
"JOIN " & Catalog & "." & Database & ".instance__site rs " &
"ON sub.Site_ID = rs.Site_ID " &
"WHERE sub.Disabled = FALSE " &
"AND sub.Study_ID  ="&P_StudyID&" ",
null,
[EnableFolding=true]
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @Dev_003 ,

You can refer the following links to get it by creating the query parameter:

Solved: Changing Data Source - Microsoft Fabric Community

vyiruanmsft_0-1728351585014.png

Using Power BI Desktop Direct Query with Parameters 

vyiruanmsft_1-1728351744193.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.