In a Pivot Table, how to subtract Sums of Values from a fixed value?

RogerPenna

New Member
Joined
Mar 27, 2017
Messages
20
So I am building this spreadsheet to monitor our suppliers.

Each delivery a supplier makes gets grades for several different aspects, like documentation compliance, quality, ponctuality, etc, etc.

The grades for each delivery are summed and multiplied by -1. Because if everything was perfect, grades are 0. Every problem adds a tiny amount.

At the end of the month, the total negative grades are subtracted from a perfect 10 grade.

So, lets say we have two suppliers, JoeMetal and JohnFuel

The table looks like this

JoeMetal : 25/01/2019 : -0,25
JoeMetal : 26/01/2019 : -1,5
JohnFuel : 26/01/2019 : -0,25
JoeMetal : 27/01/2019 : -1
JohnFuel : 05/02/2019 : -0,5
JoeMetal : 10/02/2019 : -2,5
JohnFuel : 15/02/2019 : -0,5

The pivot table I get looks like this

SUPPLIER|JAN |FEB |
JoeMetal |-2,75|-2,50|
JohnFuel |-0,25|-1 |

What I actually want is subtract all those values from 10... so 10-sum(-0,25;-1,5;-1)... 7,25. Or 72,5%, whatever :)

SUPPLIER|JAN |FEB |
JoeMetal |7,25|7,5 |
JohnFuel |9,75|9 |



How do I proceed to do that? Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
are you sure?

10-sum(-0,25;-1,5;-1) ==>> 12.5 not 7.25
but
10+sum(-0,25;-1,5;-1) ===> 7.25
 
Last edited:
Upvote 0
are you sure?

10-sum(-0,25;-1,5;-1) ==>> 12.5 not 7.25
but
10+sum(-0,25;-1,5;-1) ===> 7.25


of course you are right, sorry.

but the fact is that I want to have a monthly base perfect score of 10 and the supplier will have several negative grades along the month. Consider negative in the sense of "quality" of the grade, not in the numerical sense.

So I want to decrease, from that perfect 10, the negative grades. In the numerical sense, yes, SUM the negative grades with the base 10.

Despite the error in the sign, I think the rest of the post made it somewhat clear.
 
Upvote 0
it must be a PivotTable?

well, I started trying to do it with sumifs... it started getting complicated. While I could sum the negative grades based on supplier, I was having trouble to sum, for that supplier, only grades received in the month of the cell above (like jan/19, feb/19, etc)
 
Upvote 0
How about PowerQuery?

supplierDateValuesupplierJanuaryFebruary
JoeMetal
25/01/2019​
-0.25​
JoeMetal
7.25​
7.5​
JoeMetal
26/01/2019​
-1.5​
JohnFuel
9.75​
9​
JohnFuel
26/01/2019​
-0.25​
JoeMetal
27/01/2019​
-1​
JohnFuel
05/02/2019​
-0.5​
JoeMetal
10/02/2019​
-2.5​
JohnFuel
15/02/2019​
-0.5​

btw. I used 10+ not 10- ;)

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Extracted Month Name" = Table.TransformColumns(Source, {{"Date", each Date.MonthName(_), type text}}),
    #"Pivoted Column" = Table.Pivot(#"Extracted Month Name", List.Distinct(#"Extracted Month Name"[Date]), "Date", "Value", List.Sum),
    #"Added to Column" = Table.TransformColumns(#"Pivoted Column", {{"January", each _ + 10, type number}}),
    #"Added to Column1" = Table.TransformColumns(#"Added to Column", {{"February", each _ + 10, type number}})
in
    #"Added to Column1"[/SIZE]
 
Last edited:
Upvote 0
Looks good, but that is like greek to me. The code is VBA? Does it work in other Excel languages? (portuguese here). I don´t even know where do I access PowerQuery, or if I have it.


Seeing your signature now... Excel 2013 (MS Office Home and Business 2013) Brazilian Portuguese.
 
Last edited:
Upvote 0
Excel 2010 / 2013 need PowerQuery free add-in
Excel 2016 and above has PowerQuery built-in
this is not vba, but M-language
What is PowerQuery?
and yes it works on different language versions but doesn't change language automatically

btw. this code was created directly from PQ GUI not manually :)
 
Last edited:
Upvote 0
I will try to install it later.

right now I was able to achieve what I wanted by inserting in the pivot table a calculated field that =10+sum (sum being the name of the field with the negative grades). Only problem I have right now is that I have two columns for each month... like... Sum of Sum -0.25 and Sum of Grade 9,75

Have to find a way to hide Sum of Sum (as you can see, my experience with Pivot Table is near nil)
 
Upvote 0

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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