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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.