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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Parametrise SQL Data Source

Hi , 

 

I am looking to Parametrising (if it is a word like that) the datas source string in Power BI. I have added the  server and db paramenter and the problem is , I have to change the source for example from Dev to Test.

 

Here is the step i have been through when you go thourgh get data wizard for sql,
typed in server ,

typed in database name and

then select list of views or table to load. In this load process the connection string is populated "for each table/view" in the M Query layer. 

 

Do I need to change  the stirng in each object in Advanced Query Editor ?
Shouldnt be a easy way to change source when you load the pibx file instead of meddling with M Query?

 

regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @parry2k ,

 

Thanks for your reply.  I got you. Turns out source cannot be parametrised , if we use Direct Query mode.  In my case, as you guessed,  data coming from single source but the source string is propagated in all tables under the Source Step.


I was hoping even in this case, I can replace the strings values to parameters on each table and change the source string in Power BI Service under Parameters.
But for direct query mode , Power Bi Service doesn’t even recognise the parameters from the pbix file.  It is been listed in feature request. 

 

Related  articles 

https://community.powerbi.com/t5/Community-Blog/Using-the-Power-BI-Service-Parameters-to-change-conn...

https://ideas.powerbi.com/forums/265200-power-bi/suggestions/9312540-make-functions-refreshable-when...

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Anonymous as you know that you can connect to multiple data source in same file , like sql server, share point, excel and so on,  so basically there is connection string in each table. May be in you case you have one single source that is SQL server, you still need to update connection in each table. As you are using parameter, once you changed connection string, going forward it will be easy as everything will be driven from parameters.

 

I always use parameters when I start authoring reports coz I know most of the time when final report is built, data sources location potentially going to change.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

HI @parry2k ,

 

Thanks for your reply.  I got you. Turns out source cannot be parametrised , if we use Direct Query mode.  In my case, as you guessed,  data coming from single source but the source string is propagated in all tables under the Source Step.


I was hoping even in this case, I can replace the strings values to parameters on each table and change the source string in Power BI Service under Parameters.
But for direct query mode , Power Bi Service doesn’t even recognise the parameters from the pbix file.  It is been listed in feature request. 

 

Related  articles 

https://community.powerbi.com/t5/Community-Blog/Using-the-Power-BI-Service-Parameters-to-change-conn...

https://ideas.powerbi.com/forums/265200-power-bi/suggestions/9312540-make-functions-refreshable-when...

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

@Anonymous 

 

By the way, this is also mentioned here.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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