Need for a pivot table in the subtotal row the sum of column with averages.

%3CLINGO-SUB%20id%3D%22lingo-sub-2247643%22%20slang%3D%22en-US%22%3ENeed%20for%20a%20pivot%20table%20in%20the%20subtotal%20row%20the%20sum%20of%20column%20with%20averages.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2247643%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20need%20some%20help%20with%20totals%20and%20subtotals%20in%20a%20pivot%20table%3CBR%20%2F%3EI%20want%20that%20the%20subtotal%20row%20of%20a%20column%20with%20averages%20the%20sum%20is%20of%20the%20items%20and%20not%20the%20average%20of%20the%20items.%3CBR%20%2F%3EI%20attachment%20you%20can%20find%20in%20one%20tab%20the%20data%20and%20in%20the%20other%20tab%20the%20pivot%20table.%3CBR%20%2F%3EIn%20the%20last%20three%20columns%20the%20value%20is%20the%20average.%20The%20rows%20are%20two%20lines%20days%20and%26nbsp%3B%20RF.%26nbsp%3B%3CBR%20%2F%3EFor%20each%20day%20there%20is%20a%20subtotal%20of%20three%20RF%20lines.%26nbsp%3B%3CBR%20%2F%3EThere%20are%209%20columns.%20The%20first%206%20rows%20are%20sums%2C%20the%20last%20three%20are%20averages.%3CBR%20%2F%3EFor%20the%20subtotal%20of%20the%20day%20the%20sum%20of%20the%20three%20RF%20for%20each%20column%20has%20to%20be%20made.%3CBR%20%2F%3EFor%20the%20first%20six%20columns%20there%20is%20no%20problem.%20For%20the%20last%20three%20i%20get%20in%20the%20subtotal%20line%20the%20average%20of%20the%203%20RF%20items%20and%20not%20the%20sum%20and%20i%20need%20the%20sum.%3CBR%20%2F%3E%3CBR%20%2F%3ECan%20someone%20tell%20me%20how%20i%20can%20solve%20this%20%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20You%20in%20advance.%3CBR%20%2F%3E%3CBR%20%2F%3EMarc.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2247643%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2248705%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20for%20a%20pivot%20table%20in%20the%20subtotal%20row%20the%20sum%20of%20column%20with%20averages.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2248705%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1014133%22%20target%3D%22_blank%22%3E%40MarcBergmans%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20is%20if%20you%20are%20not%20on%20Mac.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreating%20PivotTable%20add%20data%20to%20data%20model%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20386px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F268832i165FCF6F268BBF5C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eand%20when%20create%20two%20measures%20(in%20Power%20Pivot%20or%20right%20click%20on%20table%20name%20in%20PivotTable%20pane)%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3EMD%20Average%3A%3DAVERAGE(_C70_ALMM_Extended%5BMD%5D)%0A%0Aand%0A%0ASum%20by%20day%20MD%20Average%3A%3DSUMX(%20GROUPBY(_C70_ALMM_Extended%2C%20%5BRF%5D)%2C%20%5BMD%20Average%5D)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eand%20use%20second%20one%20in%20PivotTable%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20531px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F268834i0BB6F6E971639AB4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAverage%20of%20MD%20here%20is%20built-in%20measure%20and%20here%20is%20only%20to%20compare%2C%20you%20don't%20need%20it.%3C%2FP%3E%0A%3CP%3EPlease%20check%20in%20attached%20file.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,

I need some help with totals and subtotals in a pivot table
I want that the subtotal row of a column with averages the sum is of the items and not the average of the items.
I attachment you can find in one tab the data and in the other tab the pivot table.
In the last three columns the value is the average. The rows are two lines days and  RF. 
For each day there is a subtotal of three RF lines. 
There are 9 columns. The first 6 rows are sums, the last three are averages.
For the subtotal of the day the sum of the three RF for each column has to be made.
For the first six columns there is no problem. For the last three i get in the subtotal line the average of the 3 RF items and not the sum and i need the sum.

Can someone tell me how i can solve this ?

Thank You in advance.

Marc.

7 Replies

@MarcBergmans 

That is if you are not on Mac.

 

Creating PivotTable add data to data model

image.png

and when create two measures (in Power Pivot or right click on table name in PivotTable pane)

MD Average:=AVERAGE(_C70_ALMM_Extended[MD])

and

Sum by day MD Average:=SUMX( GROUPBY(_C70_ALMM_Extended, [RF]), [MD Average])

and use second one in PivotTable

image.png

Average of MD here is built-in measure and here is only to compare, you don't need it.

Please check in attached file.

Good one @Sergei Baklan

Another way to write the same measure...

Sum by day MD Average2 :=
SUMX (
    VALUES ( _C70_ALMM_Extended[RF] ),
    [MD Average]
)

 

Thank you for the answer. It's also nice to get more than one solution.
I understand the solution but I'm still trying to apply to another sheet.
Thanks for sharing the example XLSX. This solved my problem.