cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
I_Like_Pi
Resolver II
Resolver II

Using the current folder as a variable as the Import Folder for other files?

I would like to give a powerBI to someone else to use that does not have access to my folder.

I maintain a couple excel files that create input parameters for the subsequent table imports.

I would like to modify the import code of this excell file to be relative to the current folder the pbix file is in.

 

How do I do that?

ie

Convert 

    Source = Excel.Workbook(File.Contents("C:\Subfolder\Example\SitURLs.xlsx"), null, true),

to

 

    PV_Folder=MAGICPOWERQueryFunctionforcurrentpath()

    Source = Excel.Workbook(File.Contents(""& PV_Folder &"\SitURLs.xlsx"), null, true),

 

[edited for clarity?]

3 REPLIES 3
Greg_Deckler
Super User IV
Super User IV

To my knowledge, there is no automagical way to get the current folder as a parameter to a query. That being said, you can use the "Manage Parameters" in the Power Query editor to create a parameter for folder that the end user can edit to be the correct path. In the Power Query Editor on the Home tab, use the "Manage Parameters" dialog to create a new parameter.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks smoupre,

I am going to keep hunting, but for now will hardcode a folder as a parameter that can be updated

Hi @I_Like_Pi,

 

Currently, the available values for a parameter can only from a hardcode list. For the feature to get parameter available values from a query, I would recommend you submit a feature request in the idea forum: https://ideas.powerbi.com/forums/265200-power-bi-ideas.

 

Reference
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/
http://biinsight.com/power-bi-desktop-query-parameters-part-1/

 

Regards,

Charlie Liao

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors