Forum Discussion
Accruing values weekly
I am so sorry, but I am not having success. I very much appreciate all of your help, but would it be possible for you to create a full list of ordered, numbered instructions, so when I don't see what you are showing, I can reference the step number? Again, I appreciate your help and patience.
Hi Jeff2Jets ,
Automating Data Import from a Folder in Power BI
This guide will show you how to automatically load and transform data from multiple CSV files stored in a folder using Power Query in Power BI.
Step 1: Set Up the Folder for Your Files
- Create a folder on your computer where you'll save the .csv files.
- Ensure that the structure and column headers of all CSV files are the same.
Step 2: Connect Power Query to the Folder
- Open Power Query in Power BI by navigating to Home > Transform Data > Data Source Settings.
- Click New Source > More.
- From the Get Data window, go to All > Folder and click Connect.
- Browse and select the folder containing your CSV files, then click OK.
Step 3: Combine Files in the Folder
- In the next dialog, click Combine & Transform Data.
- When prompted to select a sample file, choose one (e.g., "Week1.csv") and click OK.
- This file will serve as a template for transformations applied to all files.
Step 4: Prepare and Clean the Data
- In the Power Query editor, review the preview of your data.
- Delete the Source.Name column if it appears (this column contains the file name).
- If your data is in a single column with values separated by commas:
- Select the column, then go to Transform > Split Column > By Delimiter.
- Choose Comma ( , ) as the delimiter and select Each Occurrence, then click OK.
Step 5: Adjust Column Headers and Rows
- If column headers are in the first row of your table:
- Go to Transform > Use First Row as Headers to promote the first row to headers.
- If unnecessary rows (e.g., "Employee Name") appear:
- Filter them out by clicking the dropdown in the relevant column (e.g., "Employee Name").
- Uncheck the value(s) you want to remove and click OK.
Step 6: Group and Summarize Data
- Select the columns Employee Name and Department (or any other relevant columns).
- Right-click and choose Group By.
- In the Group By window:
- Group By: Select the column(s) to group.
- Operation: Choose an aggregation (e.g., "Sum").
- Click OK.
Step 7: Load Data
- Click Close & Apply to load the transformed data into Power BI.
Step 8: Automate Data Refresh for New Files
- To add data for new weeks:
- Save the new CSV file(s) in the same folder.
- Open Power BI and click Refresh to load the new data automatically.
Important Notes
- Ensure that all CSV files have the same structure and column headers for consistent results.
- Regularly verify the folder path to ensure new files are saved in the correct location.