Forum Discussion

astarner's avatar
astarner
Regular Visitor
7 years ago

Append new data to a history table without overwriting

I have created a history table with 2 years of data (copy and paste to create the table).  I have then created another query that will pull the auto created datasource containing new information to be formatted and what remains is only what i need.  I need to append one to the other on a weekly basis AND THEN STORE THIS INFO, without overwriting.  I need to build new history to continue to add to the history table.  In power query editor, no matter which way i slice this i cannot get it to SAVE the most recent data without overwriting it.  In my simple mind, i need to copy the new results and paste to the history table.  Note that this is a HANDS OFF query, i need it all to be automated.  Tons of posts everywhere about this, however i have yet to find a logical solution.  Any ideas?  Willing to attempt anything at this point!!! PLEASE!!!!!!

9 Replies

  • Nolock's avatar
    Nolock
    Icon for Resident Rockstar rankResident Rockstar

    Hi astarner,

    without any example it was difficult to follow you, but I think you need the function Table.Combine, which appends tables one after each other.

    If it doesn't solve your problem, please add an example what you actually have and what you expect. Thank you :)

    • astarner's avatar
      astarner
      Regular Visitor

      I have MANY files (70+) that dump out of our ERP system daily and stored in sharepoint (tsv files).  7 of these files are point in time files where they are only good for the minute that they were ran.  for example, 1 file is open PO's.  I have power BI pulling in this file and formatting it.  Because i do not have another way to store the history, i have another query that is just a table that i have typed in the history on a weekly basis.  The end result of the daily dump is a query with 2 columns (a date, and a number), the history file is exactly the same (a date and a number).  I need to append the newly formatted file (query) to the history query on a weekly basis and not keep overwriting itself.  End goal is 1 query with weekly updates.  Sounds simple - but i cannot wrap my head around this!  Thank you for your help.

  • ImkeF's avatar
    ImkeF
    Icon for Community Champion rankCommunity Champion

    Sounds like you're looking for incremental load? This feature is available in Power BI Premium. If you don't have Premium, the workarounds depend on if you want to refresh it in the service or not. So do you want a solution that works in the service?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Issue: - In power BI Desktop/ Services only current data is appending to historic data and refreshing and as soon as we are adding new data it over writing previously appended data from excel.

    On daily basis data is coming on in folder old file gets deleted in folder.

    I created historic data (HistoricData – Serial Number from 1 to 10 ) with import of excel and changed its refresh property to false so this become our historic data.

    When new file coming, I am refreshing it as Currentdata (Serial Number from 11 to 20). Now I am appending this by using union this CurrentData with HistoricData in new table as AllRecords as below.

     

    AllData = UNION(SUMMARIZE(CurrentData,CurrentDate[Date],CurrentData[Serail Number]),SUMMARIZE(Historicdata,Historicdata[Date],Historicdata[Serail Number]))

     
     

     

    On first append it works fine but as soon as I do next refresh with new date data (Serial Number from 21 to 30 ) it over write the data which was appended in last step and below.

     

     

    Is feasible using excel in Power BI ?

    Is the any approach from which I can achieve this ?

    Using SQL approach reading data from excel and maintaining it there and connecting it with Powerbi will not work for me as columns are not fixed and these can increase frequently.

     

     

  • MrAnalyticy's avatar
    MrAnalyticy
    Regular Visitor

    Try using Power Automate to query your data (if that is possible using appropriate Actions like HTTP, SQL Server etc) then append the returned data to a Dataverse table. In Power BI you would, then, connect to that Dataverse table. 

     

  • i think i have a solution for you but i need more information. i have done this sort of thing using sharepoint. the sharepoint list was a fixed roster used for attendance tracking. the names on the list are always the same but the log of the date and times change everytime a person reports their attendance. my power query code needs to get those records and keep those that changed and discards those that did not. over time the table grows.

     

    is this an accurate picture of what you need? similar, at least.