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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Gusd8
Helper I
Helper I

Setting up Dynamic Connection Strings based on table value

Thank You for looking, I am not sure exactly how to ask this question.

 

The situation there are two groups that utilze 2 versions of basically the same tool to enter data. The problem is that they are using the tool fields slightly differently...so initially I setup data connections to both resources and then merged them into a single data set with a source field. That has been more of a headache than you can imagine. I am not going to be able to change how they are using the tools, so end of story for me is I need two seperate dashboards...each pointing to the groups individual data.

I don't want to develop and maintain two dashboards, what I would like to do is develop a single dashboard and then based on a flag, control the data connection properties.

What I would typically have done in sql of vba is have a table of Group and Flag and then toggle the flag depending on which group I want active. I would then have a second table that has Group, Connection and String...which I would lookup teh string value based on the flagged group and connection being requested.

So that is my conundrum, I hope it makes sense. I figure there has to be some way to establish parameters and dynamically control data connections...I am just not sure where to even begin. Below is a quick table of the groups and the connection locations.

Thank  you in advance for any insight you are able to offer...and thank you for looking...

 

GroupFlag
MinneapolisY
Saint PaulN
  

 

GroupConnectionString
MinneapolisCon1C:\MPLS\books.csv
MinneapolisCon2C:\MPLS\tapes.csv
MinneapolisCon3C:\MPLS\disks.csv
Saint PaulCon1C:\SP\books.csv
Saint PaulCon2C:\SP\tapes.csv
Saint PaulCon3C:\SP\disks.csv

 

 

3 REPLIES 3
lbendlin
Super User
Super User

The base URL or URI (in case of folder connectors) for your data source must be constant. You need to use two separate connections.

@lbendlin, thank you for teh reply. OK, so is there any way to dynamically decide which connector to use based on some soft of flag?

Worst case scenario I save some code and when I create the duplicate pbix I go into the advanced editor and paste the correct script...but there are liek 9 connections...and I am lazy 😉 I am just so used to vba variables and flipping flag. Thank you in advance for your insight.

Read about Deployment Pipelines and the way they use parameters for connection switching between instances.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.