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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tporteous
New Member

Replace username in C:\Users\...\AppData\Roaming path in PowerBi query

Hi,

 

I have a dashboard that pulls data from a CSV file in C:\Users\...\AppData\Roaming\ folder, but want to give this to someone else, who will have a CSV file in the same location on their PC.

 

Is there a way to have the PowerBI query grab the user's appdata folder path and update the data source automatically?

 

For example, in VBA i would just use Environ("AppData").

 

any help appreciated thanks!

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @tporteous 

 

Power Query doesn't have such Environ function to get environment variable values from the local computer, so I'm afraid it is not possible to update the data source automatically. 

 

As a workaround, you can set up a query parameter for the username. Then use the parameter name to replace the fixed username section in the file path. When you give this report to other people, they just need to edit the value of the username parameter to get data from their folder. 

vjingzhang_0-1669779373424.png

 

Reference: Parameters - Power Query | Microsoft Learn

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @tporteous 

 

Power Query doesn't have such Environ function to get environment variable values from the local computer, so I'm afraid it is not possible to update the data source automatically. 

 

As a workaround, you can set up a query parameter for the username. Then use the parameter name to replace the fixed username section in the file path. When you give this report to other people, they just need to edit the value of the username parameter to get data from their folder. 

vjingzhang_0-1669779373424.png

 

Reference: Parameters - Power Query | Microsoft Learn

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors
Top Kudoed Authors