Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Team,
I have file to import in the Power BI which gets updated everyday ,and file name changes with date string on it.I want to import the file of last date on it.
For example today (02/10/2018)I have a file to import is
report_20180209.csv
next date(02/11/2018) i want the imported file to be
report_20180210.csv
I am trying to find out the proper way create parameter based on date
Thanks for your help
Thanks for sharing the detailed steps.
I could be able to do it in the Power BI Desktop, it is loading the file based on the date parameter but i can't find the input the date, once it is published to "Power BI Service". Will it be feasible to do it in Power BI Desktop?
As a beginner,it might be a basic question that I want something like based on the end user input date selection from the Power BI Service, it has to load the respective file from the source location. eg: Let's say in the below screen shot, if the end user selects a value from the dropdown then click on "view Report" then it has to load the respective file
Really appreciate your help.
Thanks
To import dynamic CSV files based on the input date from a NAS folder in Power BI, you can follow these steps:
1. **Create a Parameter for Date Input:**
- Go to the "Home" tab in Power BI.
- Click on "Manage Parameters" in the "External Data" group.
- Click on "New Parameter."
- Name the parameter something like "SelectedDate."
- Choose "Date/Time" as the data type.
- Set the allowable values to "List of values."
- Define the list of values as the dates for which you have files in your NAS folder. You can manually input these dates or generate them programmatically based on your specific requirements.
2. **Create a Custom Column for File Name:**
- In the Power Query Editor, select the table where you want to store the file names.
- Add a custom column using the "Add Column" tab.
- Use the following formula to generate the file name based on the selected date parameter:
```
"report_" & Text.From(Date.Year([SelectedDate])) & Text.PadStart(Text.From(Date.Month([SelectedDate])), 2, "0") & Text.PadStart(Text.From(Date.Day([SelectedDate])), 2, "0") & ".csv"
```
- Replace `[SelectedDate]` with the actual name of your date parameter.
3. **Load the Data:**
- Make sure that the table with the file names is enabled for load (check "Enable Load").
- Load the data into Power BI.
4. **Dynamic File Import:**
- Now that you have the file names generated based on the selected date parameter, you can create a new query that uses the generated file name to import the corresponding CSV file.
- Create a new query by going to "Home" > "Close & Apply" > "New Source" > "File."
- In the "File" dialog, select the folder where your CSV files are stored.
- In the "File Name" field, use the generated file name from your previous step by referencing the custom column you created. For example, `[GeneratedFileName]`.
5. **Load and Combine Data:**
- Load the data from the selected CSV file into Power BI.
- You can then transform, combine, or append this data as needed in your Power Query.
With these steps, you'll be able to dynamically import the CSV file based on the selected date parameter in Power BI. Each time you change the date parameter, Power BI will use the generated file name to load the corresponding CSV file.
User | Count |
---|---|
85 | |
80 | |
77 | |
49 | |
41 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |