Is it possible to add a custom calculation for a top level row total in a pivottable?

2

My Pivot Table has the following format

Manufacturer           MPG 
-   Nissan              10
      - Petrol          35
          - Model A     30
          - Model B     40
      - Diesel          45   
          - Model C     50 
          - Model D     40
+    Toyota              5
+    Chevrolet           7

It displays a list of car manufacturers, each car is classified as either Petrol/Diesel (i.e. the car type) and the miles per gallon is shown for this car. At type row level I want to see the average of the miles per gallon. For example the average of petrol Nissan cars is 35mpg (ps. these numbers are not real). This is the part I can do. The part I need help with is the manufacturer level totals: Here I want to see

Diesel Average - Petrol Average 

instead of the average of the two. Is that possible?

mark

Posted 2015-06-24T15:10:50.173

Reputation: 123

Do you have custom fields defined? – Raystafarian – 2015-06-25T17:06:48.873

yes, to compute a weighted average – mark – 2015-06-27T09:50:48.347

So what's the issue? Can't you make another custom field using those? – Raystafarian – 2015-06-29T11:45:28.307

Answers

1

I would use the Excel Data Model for this (aka Power Pivot). I would use the IF and HASONEVALUE functions in a DAX Calculation to switch between the 2 calculations depending on the level.

Mike Honey

Posted 2015-06-24T15:10:50.173

Reputation: 2 119