Skip to main content

Power BI

Needs Votes

Support relative path to excel/csv sources

Vote (727) Share
Boris Lipschitz's profile image

Boris Lipschitz on 08 Sep 2015 10:25:40

Currently, when excel file is loaded to Power BI, the absolute filepath is captured in the M query. It would be nice if relative filepath was supported. Thus we could place excel file next to pbix and not worry about the file location (local machine, shared folder on server or onedrive)

Comments (59)
Boris Lipschitz's profile image Profile Picture

bb494cfe 10e9-4c2c-b03b-800c938507b3 on 05 Jul 2020 23:52:11

RE: Support relative path to excel/csv sources

Surprising that this isn't already available

Boris Lipschitz's profile image Profile Picture

132fd647 201e-4f7a-a560-f127224b9a65 on 05 Jul 2020 23:51:23

RE: Support relative path to excel/csv sources

Absolute paths are rarely ever useful. Relative paths should be the default.

Boris Lipschitz's profile image Profile Picture

9c2e1ca8 d863-4e75-bcab-31d448110041 on 05 Jul 2020 23:50:34

RE: Support relative path to excel/csv sources

This capability exists in Excel. . .should also exist in Power BI

Boris Lipschitz's profile image Profile Picture

431581a6 37a5-4ca4-bafe-46baf59d7e7a on 05 Jul 2020 23:47:19

RE: Support relative path to excel/csv sources

I have many pbix files about 50 where I manually filter out the data using a text value. If I can have that value in the pbix file name I can get the file path and then parse it and pass it to the filter in power query. Something like var = thispbix. path

Boris Lipschitz's profile image Profile Picture

1fbbd0f6 0f02-4a3b-930e-08d76a1abfb4 on 05 Jul 2020 23:39:21

RE: Support relative path to excel/csv sources

In response to the last suggestion:
1 - create a parameter in PBI containing the 'single place' filepath
2 - save and send PBI file as template (to get prompted for the parameter)
3 - adjust your queries so your recepient can simply copy paste from explorer address bar (meaning "\filename.ext" included in your queries)
4 - recepient will open PBI template + get parameter = filepath prompt. Copy paste from explorer and all sourcefiles will work.
5 - Don't forget to save as for the PBI file (since it was a template which created a no name new file. And it does not even have to be in the same folder as the data.

But totally agree that an automated option is much more prefered.
Something like a "current PBI filepath" variable in powerquery.

Boris Lipschitz's profile image Profile Picture

b89e40e9 4c2c-4c9d-ba69-1103ed512c0e on 05 Jul 2020 23:32:38

RE: Support relative path to excel/csv sources

Whilst we wait for this feature to be implemented, in order to to ease the pain, you can define a variable that contains the folder, so you only have to change a single place: https://stackoverflow.com/a/52895973/211672

Boris Lipschitz's profile image Profile Picture

96c5ff83 76b7-4684-bfd4-8aec019e9c1e on 05 Jul 2020 23:30:38

RE: Support relative path to excel/csv sources

Pretty standard feature that is required here. It makes it so that I can't send the file and the data source to colleagues and off-load the refreshing responsibility to them. I need to edit the data source every single time I make a change to their project.

Boris Lipschitz's profile image Profile Picture

cba1c15b 69f8-45c6-a37b-ad0fc7f6e6af on 05 Jul 2020 23:29:46

RE: Support relative path to excel/csv sources

But do support also .\..\..\dir1\dir2\file.xlsx, please. Would be absolutely neccessary!

Boris Lipschitz's profile image Profile Picture

2f85d71f 3e55-40f1-86a9-3bb2f60e8de6 on 05 Jul 2020 23:26:12

RE: Support relative path to excel/csv sources

.\filename.csv
vs
D:\dropbox\excelfiles\working\filename.csv

Boris Lipschitz's profile image Profile Picture

a3309361 99be-ea11-a812-000d3a8ddfb2 on 05 Jul 2020 23:23:36

RE: Support relative path to excel/csv sources

need ittt!!!!!