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

How to change data source using script

Hi everybody,

 

do you know or is there any possibility to change data source using script? I would like to have a folder with script or instruction. And in the same folder would be pbix file. When I open pbix file, It would ask script for data source.

 

Can you help me with that?

 

Thank you for your time,

Mary

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi hanzlova,

 

“I would like to have a folder with script or instruction. And in the same folder would be pbix file. When I open pbix file, It would ask script for data source.”

<--By now power bi don’t have that feature. You can vote on these two similar ideas:

 

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7345565-power-bi-designer-api

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/8340018-power-bi-designer-and-pow...

 

 

As a workaround, to achieve your requirement, you can use “Query parameter” in edit query.    Follow steps below:

  1. Enter into edit query, open Manage Parameters. 1.png

     2. Enter new parameter name(e.g.: Server Name), select “List of values”, then enter server names or      database names. You can enter multiple server names or database names in “List of values”. You can also set “Default Value” and “Current Value” in this pane.

2.png

    3. Right click parameters in “Queries” pane and click enable load.

    4. Finally you can select server and database using query parameters like below, the parameter value is “current value” you have set. If you want to change “current value”, you can change it in “Manage Parameter” pane.

 3.png

 

You can refer to the blog for more details about Query Parameter:

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

 

Regards,

Jimmy Tao

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

Hi hanzlova,

 

“I would like to have a folder with script or instruction. And in the same folder would be pbix file. When I open pbix file, It would ask script for data source.”

<--By now power bi don’t have that feature. You can vote on these two similar ideas:

 

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7345565-power-bi-designer-api

https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/8340018-power-bi-designer-and-pow...

 

 

As a workaround, to achieve your requirement, you can use “Query parameter” in edit query.    Follow steps below:

  1. Enter into edit query, open Manage Parameters. 1.png

     2. Enter new parameter name(e.g.: Server Name), select “List of values”, then enter server names or      database names. You can enter multiple server names or database names in “List of values”. You can also set “Default Value” and “Current Value” in this pane.

2.png

    3. Right click parameters in “Queries” pane and click enable load.

    4. Finally you can select server and database using query parameters like below, the parameter value is “current value” you have set. If you want to change “current value”, you can change it in “Manage Parameter” pane.

 3.png

 

You can refer to the blog for more details about Query Parameter:

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

 

Regards,

Jimmy Tao

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.