I have 2 tables in power query which I would like to append. But before appending these 2 tables I would like to implement the following subtraction in power query. How to get around with this ? many thanks in advance.
C.Code Amount Date FiscalYearPeriod Expected Column
1001 5 15/01/2024 202401 0-5 = -5
1001 10 15/02/2024 202402 10-5 = 5
1001 20 15/03/2024 202403 20-10 = 10
1001 40 15/04/2024 202404 40-20 = 20
1001 80 15/05/2024 202405 80-40 = 40
1002 100 15/05/2024 202405 0-100 = -100
you can try this
= Table.AddColumn(#"Changed Type", "Custom", each
[a=Table.SelectRows(#"Changed Type",(x)=>x[C.Code]=[C.Code]and x[Date]<[Date]),
b= try [Amount]-a[Amount]{Table.RowCount(a)-1} otherwise 0-[Amount]
][b])