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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Getting current folder of the PBIX file

Hi there,

 

I have a process that creates bunch of CSV data of predictable shape and contents. I have a report that makes it all pretty.

 

To do so, I have created PBIX file where I defined a string parameter called ReportDataFolderPath. I am using it to load CSV from it using File.Open:

 

 

let
    Source = Csv.Document(File.Contents(ReportDataFolderPath & "\RELATIVE\file.csv"),[Delimiter=",", Columns=19, Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
...

 

 

I save the PBIX design file as PBIT template, then open template, it prompts me for the path to the new location of the files, and loads the data just like I want to.

 

I am now wondering, is there a way for me to somehow figure out a path to where the PBIT or PBIX file is being opened from, and automatically set the relative path to the CSV files.

 

If this was possible, I can pre-copy my PBIT or PBIX file into the location where my CSV files are created and just automatically open it.

 

I tried doing this:

let Source = Csv.Document(File.Contents("\RELATIVE\file.csv"),[Delimiter=",", Columns=19, Encoding=65001, QuoteStyle=QuoteStyle.Csv]),... 

 

But it does not work as the File.Open needs an absolute path.

 

Any idea of whether this is possible?

1 ACCEPTED SOLUTION

Hi @Anonymous,

Based on my research, I am afraid you could not achieve this feature currently, I suggest you submit an idea in ideas forum:

https://ideas.powerbi.com/forums/265200-power-bi-ideas

 

Regards,

Daniel He

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

View solution in original post

6 REPLIES 6
lpriceFTW
Helper II
Helper II

Did you every figure this out? Hoping that in 5 years, PBI would implement a solution to achieve this.

brodoplovac
New Member

shammadali
New Member

PBIT template solution works well for me:

 

I save the PBIX design file as PBIT template, then open template, it prompts me for the path to the new location of the files, and loads the data just like I want to.

v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

Based on my test, I have created a parameter and it seemed you need to use the full file path to set the parameter:

1.PNG

1.PNG

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Daniel, not sure what this proves - I already know that one must use absolute path to those functions

 

My question is - is it possible to retrieve the path to where PBIX/PBIT file is stored so that it can be used as input to functions to construct other paths?

 

Hi @Anonymous,

Based on my research, I am afraid you could not achieve this feature currently, I suggest you submit an idea in ideas forum:

https://ideas.powerbi.com/forums/265200-power-bi-ideas

 

Regards,

Daniel He

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.