Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chartford
Regular Visitor

problem reconcile average total

Hi there,

I'm very new to MS PowerPivot and this forum.  I've been researching how to use PowerPivot for, what will be a variety of reporting scenarios at our College.  In this test scenario I want a summary view of Term GPA's for a given semester.

 

Campus1  2.57
Campus23.12
Campus32.78
Campus42.32
Campus53.65
Campus61.86
Average received using PowerPivot2.57
  
Average using the list of 6 entries2.716666667

 

I'm at a loss for come up with a recent why this is happening. If anyone could provide some insight, that would be extremely helpful.  I've checked records counts between the raw data and the table in the PowerPivot and the record count tracks the same in both areas.  I've also checked for things like data shifting from one column to the next but the import file is tab delimited and the Access table I import into, does emit any errors.

 

Please let me know if you need more information.

 

Thanks in Advance,

Chuck Hartford

1 ACCEPTED SOLUTION

If you want the "Grand Total" to be the Average of the Term Average GPAs, then your issue is the one I posted about above. If it is not your issue, please be more specific with what you are looking for. 

 

Let me know if I have recreated your dilemma below:GPA Example3.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

Here are the DAX formulas for the measures:

Average of Term GPA :=
AVERAGE ( Table1[Term GPA] )

 

Average Term GPA - Fixed :=
AVERAGEX ( VALUES ( Table1[Term Description] ), [Average of Term GPA] )

 

What AVERAGEX does is it iterates over a table, evaluates all the averages, and then averages those results. 

VALUES returns a 1 column table of the distinct values in that column currently visible in the filter context.

 

So what we are doing is using VALUES to return this

 

Fall 2016

Fall 2017

Winter 2017

 

Then evaluating [Average of Term GPA] for each term

 

Fall 2016              3.19

Fall 2017              0.00

Winter 2017        4.00

 

And finally AVERAGEX averages all of the values we just evaluated.

 

Fall 2016              3.19

Fall 2017              0.00

Winter 2017        4.00

                            2.40

 

Let me know if this works!

 

Thanks.

View solution in original post

7 REPLIES 7
bdymit
Resolver II
Resolver II

My guess is that you are receiving what you asked for, yet are unclear regarding the idea of filter context.

 

When in a pivot table, the "Total" is calculated separately from the items above it. When the Power Pivot engine is calculating the value for "Total", it does not recognize the numbers it calculated for your individual campuses.

 

What the engine is doing for each of the campuses is taking your base data, filtering it to only the specific campus, and then calculating. When it calculates the total, it just includes all the campuses. It DOES NOT average the averages.

 

Look at these two examples (table on the left contains the Average GPAs for all the students within a given campus, as shown on the table on the right)

 

In this first example, the averages match. This is because the calculations are the same (in regards to the number of students and the cumulative sum of the GPAs. Thus, the "Average of Average GPAs" coincidentally is the same, because each campus has the same number of students.

GPA Example1.JPG

 

In this next example, I just added two more students to Campus5, but halved the GPAs for students 19 and 20. Thus, the sum for all the GPAs is the same, but the denominator has changed. So the Average of the Students GPAs is different, while the "Average of the Average Student GPAs" stays the same.

GPA Example2.JPG

 

If you want to force Power Pivot to calculate the Average of the Campus Average GPAs, you can force it to do so. Please post your measure and we can tweak it to take the Average of all the Campus Average GPAs for the "Totals" row.

 

Let me know if any of this is unclear--Thanks!

 

Ben

Hopefully this is sufficient as a sample.  This will look different from my original post as that was quite lengthy.

 

Average of Term GPAColumn Labels      
Row LabelsCampus1Campus2Campus3Campus4Campus5Campus6Grand Total
Course X2.603.403.403.203.602.003.03
Fall 20162.603.403.403.203.503.003.19
Fall 2017     0.000.00
Winter 2017    4.004.004.00
Grand Total2.603.403.403.203.602.003.03

 

ID1Term DescriptionCampusCourse NameTerm GPA
Student1Fall 2016Campus1Course X4
Student2Fall 2016Campus1Course X2
Student3Fall 2016Campus1Course X1
Student4Fall 2016Campus1Course X3
Student5Fall 2016Campus1Course X3
Student29Fall 2016Campus2Course X4
Student30Fall 2016Campus2Course X3
Student31Fall 2016Campus2Course X4
Student32Fall 2016Campus2Course X3
Student33Fall 2016Campus2Course X3
Student55Fall 2016Campus3Course X3
Student56Fall 2016Campus3Course X4
Student57Fall 2016Campus3Course X4
Student58Fall 2016Campus3Course X3
Student59Fall 2016Campus3Course X3
Student92Fall 2016Campus4Course X3
Student93Fall 2016Campus4Course X3
Student94Fall 2016Campus4Course X4
Student95Fall 2016Campus4Course X3
Student96Fall 2016Campus4Course X3
Student149Fall 2016Campus5Course X3
Student150Fall 2016Campus5Course X4
Student151Fall 2016Campus5Course X3
Student152Winter 2017Campus5Course X4
Student153Fall 2016Campus5Course X4
Student189Fall 2017Campus6Course X0
Student190Fall 2017Campus6Course X0
Student191Winter 2017Campus6Course X4
Student192Fall 2016Campus6Course X4
Student193Fall 2016Campus6Course X2

If you want the "Grand Total" to be the Average of the Term Average GPAs, then your issue is the one I posted about above. If it is not your issue, please be more specific with what you are looking for. 

 

Let me know if I have recreated your dilemma below:GPA Example3.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

Here are the DAX formulas for the measures:

Average of Term GPA :=
AVERAGE ( Table1[Term GPA] )

 

Average Term GPA - Fixed :=
AVERAGEX ( VALUES ( Table1[Term Description] ), [Average of Term GPA] )

 

What AVERAGEX does is it iterates over a table, evaluates all the averages, and then averages those results. 

VALUES returns a 1 column table of the distinct values in that column currently visible in the filter context.

 

So what we are doing is using VALUES to return this

 

Fall 2016

Fall 2017

Winter 2017

 

Then evaluating [Average of Term GPA] for each term

 

Fall 2016              3.19

Fall 2017              0.00

Winter 2017        4.00

 

And finally AVERAGEX averages all of the values we just evaluated.

 

Fall 2016              3.19

Fall 2017              0.00

Winter 2017        4.00

                            2.40

 

Let me know if this works!

 

Thanks.

Clearly I've got some additional research to do but you've certainly provided a glimpse into how this process works.  Thanks for the assistance.

Happy to help.

 

The clearest, easiest outline to understand how the DAX engine is evaluating measures is this reference card.

https://powerpivotpro.com/2015/10/giving-back-steal-this-reference-card/

 

It explains concepts like filter context, which I mentioned.

 

Here are other helpful resources.

https://www.youtube.com/watch?v=a29YqDosRYY&t=241s

https://www.youtube.com/watch?v=29frZhkwCqQ

https://www.youtube.com/watch?v=z96HqHvoZNg

https://www.youtube.com/watch?v=klQAZLr5vxA&t=34s

https://www.youtube.com/watch?v=6ncHnWMEdic&t=45s

 

Best of luck!

https://powerpivotpro.com/2012/03/subtotals-and-grand-totals-that-add-up-correctly/

 

This article summarizes the concept very well. 

 

credit to @austinsense and the P3 Team

TomMartens
Super User
Super User

Hey,

 

this is odd, using the sampledata you provided both SSAS Tabular variants (Power Pivot and Power BI) returning the same value

Power Pivot hosted in Excel 2016 (64bit)

2017-08-17_17-40-37.png

 

and Power BI (August release 64bit)

 

2017-08-17_17-43-04.png

Excited to learn what caused this issue

 

Regards 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.