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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
AshwinShyam
New Member

Connecting a Power BI report to a DB Dynamically based on the Logged in user

How can we configure Power BI reports to connect to the appropriate database for each tenant in our SAS product, where all tenants have separate databases with identical objects and schema?

1 REPLY 1
Adamboer
Responsive Resident
Responsive Resident

To connect Power BI reports to the appropriate database for each tenant in your SAS product, you can create a parameterized connection string in Power BI that allows you to dynamically switch between databases.

Here's how you can do it:

  1. Create a parameter table that contains the database name for each tenant.

  2. In Power BI Desktop, click on "Transform Data" to open the Power Query Editor.

  3. In the Power Query Editor, select "New Source" and then select "SQL Server."

  4. Enter the server name and database name of any tenant in your SAS product. This will create a connection to the database.

  5. In the Power Query Editor, right-click on the connection you just created and select "Advanced Editor."

  6. In the Advanced Editor, replace the database name with a reference to the database name parameter in your parameter table.

  7. Save and close the Advanced Editor.

  8. In the Power Query Editor, create a new parameter called "Tenant" that will be used to switch between databases.

  9. Use the "Tenant" parameter in your query to dynamically switch between databases based on the value of the "Tenant" parameter.

  10. Create a report based on the query.

  11. Publish the report to the Power BI service.

  12. In the Power BI service, create a new parameter called "Tenant" that will be used to switch between databases.

  13. Use the "Tenant" parameter in your report to dynamically switch between databases based on the value of the "Tenant" parameter.

By following these steps, you will be able to configure Power BI reports to connect to the appropriate database for each tenant in your SAS product.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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