Calculate Difference Between Columns in Pivot Table

user0X

New member
Joined
May 5, 2018
Messages
22
Reaction score
0
Points
1
Excel Version(s)
2019
Is there a method/formula to calculate the difference between two columns generated from a single row for a pivot table?

Difference Between Rows.JPG
 

Attachments

  • Difference Between Rows.xlsx
    13.4 KB · Views: 16
Pivot your data in Power Query and add a new column

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Description", type text}, {"Amt", Int64.Type}, {"Type", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Date"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Type]), "Type", "Amt", List.Sum),
    #"Added Custom" = Table.AddColumn(#"Pivoted Column", "Claim -CR", each [Claim]-[Cr])
in
    #"Added Custom"
 

Attachments

  • Difference Between Rows.xlsx
    137.4 KB · Views: 18
Back
Top