Power Pivot in Excel and Count the number of entries above average

DrDebit

Board Regular
Joined
May 20, 2013
Messages
123
Office Version
  1. 365
Platform
  1. Windows
If I have a table of numbers, called scores: 1...10. They are in the data set called Tests.

I have the following calculated fields:

Count Tests:=COUNTROWS(Tests) ... =10
Average Tests:=AVERAGE(Tests[Scores]) ... 5.5
Count Tests Above Average:=CALCULATE([Count Tests],Tests[Scores]>5.5) ... 5

All good so far, but if I change the last calculated field:

Count Tests Above Average 2:=CALCULATE([Count Tests],Tests[Scores]>[Average Tests]) ... I get an error message.

Is there an easy solution to this?

Thank you!

1621881082308.png
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You could use:

Excel Formula:
Count Tests Above Average:=VAR AveMeasure=[Average Tests] RETURN Countrows(FILTER(Tests,Tests[Scores]>AveMeasure))
 
Upvote 0
Thank you, Rory. Do you have to use VAR, or is there another way?
 
Upvote 0
You could use AVERAGE directly in the CALCULATE filter criteria rather than supplying a measure.
 
Upvote 0
Yes...I think that I tried it and it didn't work.

Count Tests Above Average 2:=CALCULATE([Count Tests],Tests[Scores]>[Average Tests]) ... I get an error message.

Again, many thanks!
 
Upvote 0
No, that's using the measure you created. I mean using:

Excel Formula:
=CALCULATE([Count Tests],Tests[Scores]>AVERAGE(Tests[Scores]))
 
Upvote 0
I get an error: Semantic Error: A function "AVERAGE' has been used in a true/false expression that is used as a table filter expression. This is not allowed.

...but Count Tests ABove Average 3:=CALCULATE([Count Tests],filter(Tests,Tests[Scores]>AVERAGE(Tests[Scores]))) works.

What I don't understand is if I calculate the Average Score and call it AVerage Tests (as I did above), you can't use that. However, if I do the formula for average inside the function it works.

Thank you, Rory.
 
Upvote 0

Forum statistics

Threads
1,223,714
Messages
6,174,048
Members
452,542
Latest member
Bricklin

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