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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
raaan12
Frequent Visitor

Switching Between Test and Production Databases in Power BI

Hi everyone,

I have a question regarding environment management in Power BI. I’m working with two different MongoDB databases that have the exact same structure but different data—one for testing and one for production. I’ve done all the data modeling, transformations, and report creation using the test database.

Now, when it’s time to move to production, do I have to redo everything using the production database, or is there a way in Power BI to simply switch the data source while keeping all the transformations and visuals intact, given that the structure is identical? I’m looking for the most efficient way to handle this kind of environment switch.

Thanks in advance for your help!

1 ACCEPTED SOLUTION
mh2587
Super User
Super User

You don't need to redo everything just create two parameters one for test and one for prod, just follow the below steps


Steps to Switch MongoDB Environments in Power BI

Step 1: Create a Parameter

  1. Go to Home in Power BI Desktop.

  2. Select Manage Parameters, then choose New Parameter.

  3. Name it something like MongoDB_URI.

  4. Set the Type to Text.

  5. Enter your test MongoDB connection string (e.g., mongodb://test-server:27017) as the Current Value.

  6. Click OK.


    Step 2: Use the Parameter in Power Query

    1. Go to Transform Data to open Power Query Editor.

    2. Find your existing MongoDB source step in the query (usually called Source).

    3. Replace the hardcoded URI with the parameter: MongoDB.Contents(MongoDB_URI)

    4. Click Close & Apply.


      Step 3: Switch to Production

      1. Go back to Manage Parameters.

      2. Change the MongoDB_URI value to your production MongoDB URI (e.g., mongodb://prod-server:27017).

      3. Apply the changes.

      4. Refresh your data.

        For better understanding follow the below video:
        https://www.youtube.com/watch?v=OnaDJkGOmIE


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



View solution in original post

2 REPLIES 2
mh2587
Super User
Super User

You don't need to redo everything just create two parameters one for test and one for prod, just follow the below steps


Steps to Switch MongoDB Environments in Power BI

Step 1: Create a Parameter

  1. Go to Home in Power BI Desktop.

  2. Select Manage Parameters, then choose New Parameter.

  3. Name it something like MongoDB_URI.

  4. Set the Type to Text.

  5. Enter your test MongoDB connection string (e.g., mongodb://test-server:27017) as the Current Value.

  6. Click OK.


    Step 2: Use the Parameter in Power Query

    1. Go to Transform Data to open Power Query Editor.

    2. Find your existing MongoDB source step in the query (usually called Source).

    3. Replace the hardcoded URI with the parameter: MongoDB.Contents(MongoDB_URI)

    4. Click Close & Apply.


      Step 3: Switch to Production

      1. Go back to Manage Parameters.

      2. Change the MongoDB_URI value to your production MongoDB URI (e.g., mongodb://prod-server:27017).

      3. Apply the changes.

      4. Refresh your data.

        For better understanding follow the below video:
        https://www.youtube.com/watch?v=OnaDJkGOmIE


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



thank you for this response, I'll try that thank you again!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.