Pivot Table Positive Numbers Only

gavs73

Board Regular
Joined
Apr 22, 2008
Messages
138
Hi

Is there a way to get a Pivot Table to only Sum Positive or Negative Values ?, I have a column of numbers, and I want to split it in the Pivot Table as a Positive set and a Negative Set.

Obviously I could split the column in the Excel sheet first and then sum those two columns, but I'd prefer to do it in the Pivot Table with a Custom Field if possible, as it is a large data set and it refreshes via SQL.

Thanks in advance for any help.

Kind Regards
Gavin
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You could add a column with P or N as a result of a formula to see if they are positive or negative.
 
Upvote 0
with Power Query and with Pivot Table as result
ProductPriceAttributeGreater
item1-3
item2-9Row LabelsSum of Value
item3-1item44
item44item56
item56item78
item6-9Grand Total18
item78
item8-10
AttributeLess
Row LabelsSum of Value
item1-3
item2-9
item3-1
item6-9
item8-10
Grand Total-32
ptfields.png
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Greater = Table.AddColumn(Source, "Greater", each if [Price] > 0 then [Price] else null),
    Less = Table.AddColumn(Greater, "Less", each if [Price] < 0 then [Price] else null),
    UOSC = Table.Unpivot(Less, {"Greater", "Less"}, "Attribute", "Value")
in
    UOSC
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top