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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MODUser
Frequent Visitor

Daily File Update/Overwrite

Created a query to pull a daily csv file, for which I have no creation control, that is auto saved to SharePoint. With each new daily file I need to overwrite the dated data in the existing query table with the new file data. Each file has the same format and titled with the run date and file name (name does not change), that is...20231012_File Name, 20231013_File Name etc.

 

For example, if the existing query table has dated data from 1/1/2023 through to 10/12/2023 and the new day's cvs file has dated data 10/2/2023 - 10/13/2023, I need to, essentially, delete all rows in the existing query table having the dates 10/2/2023 - 10/12/2023, then add the new file 10/2/2023 - 10/13/2023 data to the existing query table. How can I accomplish this within Power Query?

1 ACCEPTED SOLUTION
MODUser
Frequent Visitor

5 REPLIES 5
MODUser
Frequent Visitor

Found a solution that worked for me....

Remove Duplicates and Keep Most Recent

edhans
Super User
Super User

  1. Get the dates from the new table.
  2. Create a list of those new dates.
  3. Use a filter. See https://www.ehansalytics.com/blog/2020/5/20/using-listcontains-to-filter-dimension-tables for an example. However, you will add a 'not' in front of the List.Contains() function to filter those records out.
  4. Append your new table to the existing data


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans  Apologies for the late response. How does this change if the the goal is to do this within Power Query Editor?

My steps above were for Power Query. You need to provide us some examples so we can help. 

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

I walked through the process with the following issues/concerns...

1. The daily file has dates that overlap the prior day's daily file and the main file...how do I keep/save the updated existing data file each next day in order to apply the next day's daily file updates? For example, main file is 1/1/2023 through 10/14/2023. Monday's daily file is 9/30/2023 - 10/15/2023 and Tuesday's daily file is  10/01/2023 - 10/16/2023. Using the List.Contains filter on the main file on Monday removes the data rows dated 9/30 - 10/14 from the main file, then through the append step adds Monday's daily file data rows 09/30/2023 - 10/15/2023 to the main file. On Tuesday, I need to apply the Tuesday daily file to the Monday appended main file now having data rows dated 1/1/2023 - 10/15/2023... and so on each day.

2. The main file has over 10 million rows and continues to grow with each new daily file, and the close/load is taking a long time to load..in 10 minutes only 150 rows loaded and the load was eventually halted. Enable Load is unchecked for the daily file table and the reference list and I was only loading the updated main file.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.