cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## How can I calculate an average value vs the overall average for all values in the column?

Hello,

I am trying to create a calculated column that will show the average score by agency minus the average score for all agenecies.  I hand calculated the third column (Variance to overall average).  How can I program this?  I have the average scores for each agency but I want to see how each agency's average compares to the overall average of all the agencies.  Sample below, for example, the FBI is 0.3 under the avarge of all agencies (4.9-5.2).  The average survey score is from several thousand responses that Power BI has calculated the average for each agency.  Thanks

 Agency Average survey score (1 to 7) Variance to overall average FBI 4.9 -0.3 DoJ 5.2 0 DoD 6.0 0.8 NSA 4.8 -0.4 Average all agencies 5.2

1 ACCEPTED SOLUTION
Community Support

Hi @Eric5605 ,

Please try to create a measure with below dax formula:

``````Measure =
VAR _a =
AVERAGEX ( ALL ( 'Table' ), [Average Score] )
VAR cur_avg =
SELECTEDVALUE ( 'Table'[Average Score] )
RETURN
cur_avg - _a
``````

For more details, please refer the attached .pbix file.

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

Hi @Eric5605 ,

Please try to create a measure with below dax formula:

``````Measure =
VAR _a =
AVERAGEX ( ALL ( 'Table' ), [Average Score] )
VAR cur_avg =
SELECTEDVALUE ( 'Table'[Average Score] )
RETURN
cur_avg - _a
``````

For more details, please refer the attached .pbix file.

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Frequent Visitor

Thank you so much!

Frequent Visitor

Hi Muhammad, thank you so much for your reponse.  I tried the formula you sent, but it seems that the overall average isn't matching.  Below is the actual data rather than the sample in my original post.  You can see how many people responded to from each agency and the average score by agency for this question on the survey.  The average for all agencies is 5.27.  So for agency A, the variance to overall average should be 4.90-5.27 = -0.37.  The formula is producing an answer of -0.13.  It seems the second half of the formula

`CALCULATE(AVERAGE([Average survey score]), ALL('YourTable'))`

Is producing an overall average of 5.03, not 5.27.  Am I doing something wrong.  Thanks again for your help.

 Agency # of responses Average Score Variance to Overall Ave A 915 4.90 -0.13 B 331 5.18 0.15 C 4180 5.32 0.29 D 104 5.42 0.39 E 290 5.33 0.31 F 598 5.11 0.08 G 1399 5.11 0.08 H 75 5.16 0.13 I 518 5.37 0.35 J 141 5.24 0.21 K 690 4.69 -0.34 L 537 5.14 0.11 M 688 5.31 0.28 N 726 5.27 0.25 O 1453 4.99 -0.04 P 358 4.96 -0.07 Q 294 5.59 0.56 R 222 5.74 0.71 S 58 5.16 0.13 T 55 5.58 0.55 U 51 5.39 0.36 V 59 5.85 0.82 W 744 5.37 0.34 Total 14486 5.27 0.17
Super User
``````Variance to overall average = [Average survey score] - CALCULATE(AVERAGE([Average survey score]), ALL('YourTable'))
``````

Proud to be a Super User!