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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dynamically change data source

I have a quite specific use-case that is testing my capabilities. And probably going against intended use of Power BI.

 

I have a report that calculates TCO of Microsoft Azure Products based on data from a tool called Movere for a specific customer.

 

The folder structure for the report is similar to: C:\User\Me\(...)\TCO Calculator\TCO Calculator.pbix and for the data: C:\User\Me\(...)\TCO Calculator\Data\csv1.csv

 

I have done the quering and produced a fantastic report with all the bells and whistles.

 

What I know want to do, is make it possible for me to share the tool with my colleagues, for when they want to use it with Movere data from another customer.

 

Ideally, they should just be able to copy the folder with the report and subfolders, replace the .csv files, open the report and press "Refresh". But as you know, Power BI will complain that the file paths of the data sources do not exist.

 

Is there a way to decouple the data paths in the report, so it points to the just the subfolder and won't require a full path including the C:\User portion of it?

 

1 ACCEPTED SOLUTION

Hi @Anonymous

Yes, your requirement can be achieved.

i make a test.

create parameter called "csvname"

use this parameter in the Advanced editor

11.png

 

 

Reference:

Power BI – Using Parameters for Flat File / CSV / Excel Sources

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

 

Best Regards

Maggie

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

As tested, if file "csv1.csv" and "csv2.csv" have the same table structure

(they have the same columns and columns' names, only the values of the cells are different from two files)

for example

csv1.csv

a b c d e
1 3 1 1 1
2 4 2 2

2

csv2.csv

a b c d e
10 10 10 10 10
11 10 10 10 10

 

 

Then when you import csv1.csv into Power BI Desktop, and create a visual using columns from it,

You could also change the data source to csv2.csv in the same pbix.

go to Edit Queries->Data source setting->change data sources->click on "Browse"

1.png

 

Select csv2.csv, then click "ok"->click on "apply changes"

 

Best Regards

Maggie

 

Anonymous
Not applicable

Hi Maggie

 

Thank you for your reply, that indeed works. But what I am looking for is a little less work (things that can go wrong) if my colleagues applies new sources.

 

I've heard a little about you can create query parameters, and save the report as a template. So when it opens it will prompt for the location of the .csv files. This is closer to what I am looking for, but would still prefer something similarly to what you can do with Powershell and using the ".\" path that points to the location of the script. Here it would instead be the location of the power-bi report.

Hi @Anonymous

Yes, your requirement can be achieved.

i make a test.

create parameter called "csvname"

use this parameter in the Advanced editor

11.png

 

 

Reference:

Power BI – Using Parameters for Flat File / CSV / Excel Sources

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

 

Best Regards

Maggie

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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