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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
MeganBig
Regular Visitor

Dynamic DataSources in Power BI Report Builder

Hello! We have many clients that each have their own sql server and database but the database structure is the same across all instances. Instead of building the same report for each client, we create one paginated report with a parameter that changes based on who is viewing the report. This has me researching how to dynamically change the data source on a sql query but I am running into a credential issue.

 

I am using power query inside power bi report builder to dynamically change the datasource. I initially set up the sql query with Server A and Database A. After I confirmed it was working accordingly, I converted the sql connections to use the parameters I created to dynamically change what server/database the sql query would run on.

MeganBig_0-1721681532951.png

 

Testing this out, I run for a client on Server A and Database A and the report works fine. I test running for the same client but in a different environment (Server B and Database B) and receive a credential error even though the credentials to access the two different servers/databases are the same. 

MeganBig_2-1721681785646.png

I have tried adding in multiple data source connections (Server A, Database A; Server B, Database B, etc) into the rdl file (through datasources, not power query), deploying to the service and running the report. I can still only get the report to successfully run when connecting to Server A, Database A. 

 

I have tried changing the authentication method of the power query to Service Principal inside the rdl file but continue to receive the credential error if the connection is not Server A, Database A.

 

I have tried changing the authentication method in the gateway and cloud connections setting of the report to Service Principal but receive the error below, even when connecting to Server A, Database A.

MeganBig_3-1721682127128.png

 

Is dynamically changing data sources in power bi report builder something that is even possible? Is there a way around the credential error that keeps occurring? Any insight or help towards a solution would be greatly appreciated.

 

Note: Moving to Power BI Desktop is not an option.

3 REPLIES 3
MeganBig
Regular Visitor

@GilbertQ I appreciate the response but RLS is not something we are struggling with. We already have a filtering solution based on who is using the report. It is an architectural decision to have each client on their own database and hoping we can find a solution on the reporting side to support that. 

Hi @MeganBig 

 

Unfortunately as Power BI is currently designed there is no way to dynamically create a data source per customer. You might be able to automate it by using the REST API to create the data sources?

 

Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

GilbertQ
Super User
Super User

Hi @MeganBig 

 

As far as I know it is not possible, it would be better to have all the data in a single database and then use RLS to filter based on the logged in user?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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