cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
pkoetzing Regular Visitor
Regular Visitor

How to switch sources within sharepoint folder

I'm using an Excel file with various tables as input source to my queries. As long as this file is stored on my local drive, I can simply switch to another file using "data source settings" - "change source". But when the file is located within a sharepoint folder I don't have that option. Instead I would have to change the path in every single query using the advanced editor. Is there any way to use a kind of "global parameter" in PowerBI so that this change needs to be done in one place only?

1 ACCEPTED SOLUTION

Accepted Solutions
pkoetzing Regular Visitor
Regular Visitor

Re: How to switch sources within sharepoint folder

Just figured it out myself: Goto "Query Editor". On "Manage Parameters" select "New Parameter" and enter a name, a list of values and a current value. Then in "Advanced Editor" simply refer to that parameter, e.g.

 

    File = Source{[Name=MyFileParameter,#"Folder Path"=MyPathParameter]}[Content]

 

 

View solution in original post

5 REPLIES 5
pkoetzing Regular Visitor
Regular Visitor

Re: How to switch sources within sharepoint folder

Just figured it out myself: Goto "Query Editor". On "Manage Parameters" select "New Parameter" and enter a name, a list of values and a current value. Then in "Advanced Editor" simply refer to that parameter, e.g.

 

    File = Source{[Name=MyFileParameter,#"Folder Path"=MyPathParameter]}[Content]

 

 

View solution in original post

anacerco Frequent Visitor
Frequent Visitor

Re: How to switch sources within sharepoint folder

Hello!

 

I have same issue and I am not exactly sure how you define a list of values for a parameter, could you please explain?

pkoetzing Regular Visitor
Regular Visitor

Re: How to switch sources within sharepoint folder

Hi,

 

Actually I wasn't using a list of values for one parameter, but different parameters for site_url, folder_name and file_name. But in the Power Query Editor you can go to 'Manage Paremeters' and under 'Suggested Values' select 'List of values' and then type your list in.

 

See an example here: https://powerbi.microsoft.com/de-de/blog/deep-dive-into-query-parameters-and-power-bi-templates/

JoeRobert06 Regular Visitor
Regular Visitor

Re: How to switch sources within sharepoint folder

if you can provide the m code for this example, that would be awesome.

 

Thanks for the share!

JoeRobert06 Regular Visitor
Regular Visitor

Re: How to switch sources within sharepoint folder

I figured it out, see below screenshot as reference. You can create parameters for each argument shown below in yellow and do not need to place (") or (&) symbols. In my case, all I needed was a parameter to toggle the filepath and left the other arguments alone.

 

2019-12-13_screenshot.png

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors