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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
WillBeeSEA
Helper III
Helper III

Trying to use %USERNAME% or %USERPROFILE% in path of source files

I would like to use  %USERNAME% or %USERPROFILE% in the Data source settings, such as the image below.  This way, users can put the source files in their own Documents folder no matter who they are.

WillBeeSEA_1-1753297830975.png

WillBeeSEA_2-1753298035498.png

It seems to accept it when I entered that and clicked OK, but when I click "Apply Changes" it reports the error "File or folder: Could not find a part of the path."

----------

I also tried %USERPROFILE% to eliminate the need for "C:\Users\"

WillBeeSEA_3-1753298157558.png

... but that time, all I did was enter it and click OK, and it immediately reported: "We didn't find any data sources in this file."

 

Any ideas?  Thank you.

 

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @WillBeeSEA ,

Power Query cannot access environment variables. And there is no built in function to do so either. Perhaps with python inside Power Query, you can do that.

 

However, why do you actually want to even do this? As this is very bad design. Why can't you put the file on shared place like a sharepoint folder or, if you really need this, perhaps create folder in C:\ directly, so everyone can have the same path. 

In general using local path to access files is not the best idea + you can't really easily refresh it on PBI Service either.

View solution in original post

2 REPLIES 2
vojtechsima
Super User
Super User

Hello, @WillBeeSEA ,

Power Query cannot access environment variables. And there is no built in function to do so either. Perhaps with python inside Power Query, you can do that.

 

However, why do you actually want to even do this? As this is very bad design. Why can't you put the file on shared place like a sharepoint folder or, if you really need this, perhaps create folder in C:\ directly, so everyone can have the same path. 

In general using local path to access files is not the best idea + you can't really easily refresh it on PBI Service either.

Hi vojtechsima, 

Thank you for the information about the PQE not being able to access environment variables. and yes, it is not the best approach.  I like your other options better.

Will

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors