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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors