Hi @vkarthik21,
Give this a go. Just paste the code in a new blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dZHBCsMgDIbfxbOCsRR2HYMOxt6geEiHh0BRUff+u6ytNfWcn//Ll8yzGEC90CsD8pnCN8p7zq5kabTWwko+fxMutFIhlyWM/5C5qcktrGTQnXldYkZGmsij/7ithgceIcWQsOwRAJ7BSAXXapcOpV6Gpw7UyZyfZ+Nd1R3+jdrFBZkbL2nUdnmOOR2af6Mr1wE2dcLaHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Reporting Date,Level,Item,Amount" = _t]),
DemoteHeaders = Table.DemoteHeaders(Source),
SplitColumn = Table.SplitColumn(DemoteHeaders, "Column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3", "Column1.4"}),
PromoteHeaders = Table.PromoteHeaders(SplitColumn, [PromoteAllScalars=true]),
ChType = Table.TransformColumnTypes(PromoteHeaders,{{"Reporting Date", type date}, {"Level", type text}, {"Item", type text}, {"Amount", Int64.Type}}),
GroupData = Table.Buffer( Table.RemoveColumns( Table.SelectRows( ChType, each [Level] = "Group"), "Level" )),
DivisionData = Table.Group(Table.SelectRows(ChType, each ([Level] <> "Group")), {"Reporting Date", "Item"}, {{"Temp Amount", each List.Sum([Amount]), type nullable number}}),
NewAmount = Table.RemoveColumns( Table.AddColumn(DivisionData, "Amount", each Table.SelectRows( GroupData, (IT) => IT[Reporting Date] = [Reporting Date] and IT[Item] = [Item]){0}[Amount]? - [Temp Amount], type number ), "Temp Amount" ),
NewLevel = Table.ReorderColumns( Table.AddColumn(NewAmount, "Level", each "Other", type text), Table.ColumnNames( ChType )),
CombinedResult = Table.Combine({ChType, NewLevel})
in
CombinedResult
I hope this is helpful.