Forum Discussion
Changes to historical data
Hello,
I want to create a table with changes to historical data without overwriting of existing data.
Example:
Data is loaded to PowerBi from Excel file:
nmmn
| Date | Date of change | Product | Order | Order Line | Price |
| 01.01.2023 | 01.01.2023 | Product A | 001 | 01 | 200 |
| 01.01.2023 | 01.01.2023 | Product B | 001 | 02 | 300 |
| 01.01.2023 | 01.01.2023 | Product B | 002 | 01 | 300 |
Every day I load the updated data and there might be changes to the existing rows. In this case I don't want to just overwrite the existing data, but instead create a row with correction.
Data on the next day (new line is added, one line is removed and one line is changed):
| Date | Date of change | Product | Order | Order Line | Price |
| 01.01.2023 | 02.01.2023 | Product B | 001 | 02 | 400 |
| 01.01.2023 | 01.01.2023 | Product B | 002 | 01 | 300 |
| 02.01.2023 | 02.01.2023 | Product A | 003 | 01 | 200 |
I want the final table looks like this(with initial lines, but also with the correction to balance them):
| Date | Date of change | Product | Order | Order Line | Price | Type |
| 01.01.2023 | 01.01.2023 | Product A | 001 | 01 | 200 | Order |
| 01.01.2023 | 01.01.2023 | Product B | 001 | 02 | 300 | Order |
| 01.01.2023 | 01.01.2023 | Product B | 002 | 01 | 300 | Order |
| 02.01.2023 | 02.01.2023 | Product A | 003 | 01 | 200 | Order |
| 02.01.2023 | 02.01.2023 | Product B | 001 | 02 | 100 | Changed |
| 02.01.2023 | 02.01.2023 | Product A | 001 | 01 | -200 | Removed |
Is it possible to create something like this in PowerBi?
Thank you in advance!
2 Replies
- amitchandakSuper User
Anton999 , Check if this approach can help to append, and then you build new column with help earlier
https://blog.crossjoin.co.uk/2020/04/13/keep-the-existing-data-in-your-power-bi-dataset-and-add-new-data-to-it-using-incremental-refresh/
https://www.thebiccountant.com/2017/01/11/incremental-load-in-powerbi-using-dax-union/Throwback: Power BI DAX- Earlier, I should have known Earlier: https://youtu.be/CVW6YwvHHi8
- Anton999New Member
As I understand this will not update older records, but it won't balance udapted records.