How to Add Correct Grand Total for Rows

pjmorris

Well-known Member
Joined
Aug 2, 2012
Messages
2,158
Office Version
  1. 365
Platform
  1. Windows
Col1

Col2

Col3

Col4

GrandTotal
Row1
xx
xx
xx
xx
MeasureTotal
Row2
xx
MeasureTotal
Row3
xx
xx
MeasureTotal

<tbody>
</tbody>



I know how to create measures and the Row/Col entries on my PivotTable are correct. But the Grand Total is not - I assume that the solution to obtaining the number will be the correct use of CALCULATE, which I'm investigating separately. My question is that having correctly formed the measure how do I add it to the PivotTable so that it is a Grand Total for a ROW (not Column) and hence only appears once and not for every Column of which there are several.

The outcome I'm seeking is shown above. What I get are multiple copies of the 'MeasureTotal' against each column.

I feel this is either something simple, or impossible. If you can tell me which and how if the former it will help enormously.

Many thanks.

Peter
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
generally You can use the HASONEVALUE function to determine which measure to call

IF ( HASONEVALUE ( CategoryOnColumns ), [measure for cells within pivot table], [measure for grand total] )

there are other ways to do it depending on the calculations you are doing
 
Upvote 0
Hi, I'm sure I'm missing something easy, but however I define the measure how do I make it appear only once for each row despite there being multiple columns?
 
Upvote 0
Hi, Apologies for the delay in replying - but its take me this long to create some sample data and feel confident that I've asked the right question.

Background: I will have two tables. the first will contain a list of tasks (rows) and all possible resource groups (columns - called Booking Groups). For each booking group I have a certain amount of available resource (hours) which I want to assign to the tasks based on their expected effort (a percentage). The issue described above is that while I made individual entries work I couldn't get the Grand Total Rows to work. I've been going mad trying to identify the cause). I think the following comments now describe at least part of the problem.

Data Source. This is a small sample of how the task table might look which is how users like to enter their assignments:

Excel 2016 (Windows) 32 bit



Data Table of Tasks against Booking Groups

Booking Groups
Task A C D
Task T1
20%​

Task T2
5%​

Task G3
80%​

Task G4
11%​
10%​

Task Something
84%​
60%​

<tbody>
</tbody>
Sheet: Sheet1

<tbody>
</tbody>


When 'Unpivoted' using PowerQuery this becomes:

Excel 2016 (Windows) 32 bit


TASKBooking GroupExpected Effort

Task T1
A​
20%​

Task T1
D​
10%​

Task T2
C​
5%​

Task T2
D​
10%​

Task G3
A​
80%​

Task G3
D​
10%​
Task G4
C​
11%​

Task G4
D​
10%​

Task Something
C​
84%​
Task Something
D​
60%​

<tbody>
</tbody>
Sheet: Sheet1

<tbody>
</tbody>


Then, using PowerPivot, I created the following table. One set of column entries is an implicit calculation 'Sum of Expected Effort' the other is a measure defined as 'SummedEffort'=sum('ExpectedEffort by Booking Group'[Expected Effort]) The two results are clearly different when I expected them to be the same (I'm reading Rob Collie's book on PowerBI etc which discusses implicit and explicit functions). The correct entry I believe are the ones in the 'Sum of Expected Effort' columns. I think it is this difference which is causing my problems as I need to multiply SummedEffort by the available resource - if SummedEffort were the same as the other column all would be well in the world.


Excel 2016 (Windows) 32 bit


Column Labels

A
C
D
Total Sum of Expected Effort
Total SummedEffort

Row Labels
Sum of Expected Effort
SummedEffort
Sum of Expected Effort
SummedEffort
Sum of Expected Effort
SummedEffort

Task G3
80%​
300%​
10%​
300%​
90%​
300%​

Task G4
11%​
300%​
10%​
300%​
21%​
300%​

Task Something
84%​
300%​
60%​
300%​
144%​
300%​

Task T1
20%​
300%​
10%​
300%​
30%​
300%​

Task T2
5%​
300%​
10%​
300%​
15%​
300%​

Grand Total
100%
300%
100%
300%
100%
300%
300%
300%

<tbody>
</tbody>
Sheet: Sheet1

<tbody>
</tbody>


I suspect the answer lies in the correct use of 'Calculate(...)', but I don't seem to be able to get it right. Grateful for any advice or guidance.

Regards

Peter
 
Last edited:
Upvote 0
It looks like a relationship problem because you are getting the table total when using your measure, with the relationship correctly set up I am getting the right numbers.
Also be careful on your un-pivot steps, the group D ( 10 % ) is getting assigned to tasks that have Group D blank in the original table
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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