Hi all,
I have read a lot of the discussions here and I am really struggling to find a solution for the following case:
I have the following dataset:
| Period_Start_Date | Contract_Number | Invoice_Number | Invoice_Date | Amount 1 | Amount 2 | Amount 3 | Amount 4 |
| 2021-02-01 | 1234 | 5678 | 2021-01-18 | 77777 | 222 | 10 | 222 |
| 2021-03-01 | 1234 | 5678 | 2021-01-18 | 77777 | 11 | 20 | 4 |
| 2021-04-01 | 1234 | 5678 | 2021-01-18 | 77777 | 222 | 40 | 5 |
| 2021-05-01 | 7777 | 8888 | 2021-03-15 | 12512 | 444 | 50 | 1 |
| 2021-06-01 | 7777 | 8888 | 2021-03-15 | 12512 | 555 | 60 | 6 |
Each Contract has it's contract number and invoice number, 1 contract may have more than 1 invoice number.
I would like my dataset to always start from the invoice_date date, as such I need to create an extra line at the top of each contract / invoice number so I can have the following:
| Period_Start_Date | Contract_Number | Invoice_Number | Invoice_Date | Amount 1 | Amount 2 | Amount 3 | Amount 4 |
| 2021-01-18 | 1234 | 5678 | 2021-01-18 | 77777 | 0 | 0 | 77777 |
| 2021-02-01 | 1234 | 5678 | 2021-01-18 | 77777 | 222 | 10 | 222 |
| 2021-03-01 | 1234 | 5678 | 2021-01-18 | 77777 | 11 | 20 | 4 |
| 2021-04-01 | 1234 | 5678 | 2021-01-18 | 77777 | 222 | 40 | 5 |
| 2021-03-15 | 7777 | 8888 | 2021-03-15 | 12512 | 0 | 0 | 12512 |
| 2021-05-01 | 7777 | 8888 | 2021-03-15 | 12512 | 444 | 50 | 1 |
| 2021-06-01 | 7777 | 8888 | 2021-03-15 | 12512 | 555 | 60 | 6 |
I will add some colors for clarity:

Period_Start_Date = First Invoice Date (marked in yellow)
Contract_Number = Same as the first line of the contract/invoice (marked in orange)
Invoice_Number = Same as the first line of the contract/invoice (marked in orange)
Invoice_Date = Same as the first line of the contract/invoice (marked in yellow)
Amount 1 = Same as the first line of the contract/invoice (marked in blue)
Amount 2 = Always 0 for the first line (the created line)
Amount 3 = Always 0 for the first line (the created line)
Amount 4 = Amount 1
Can anyone suggest anything here?