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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Eric5605
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
FBI4.9-0.3
DoJ5.20
DoD6.00.8
NSA4.8-0.4
Average all agencies5.2 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

vbinbinyumsft_0-1696998259962.png

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.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

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

vbinbinyumsft_0-1696998259962.png

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.

Thank you so much!

Eric5605
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 responsesAverage ScoreVariance to Overall Ave
A9154.90-0.13
B3315.180.15
C41805.320.29
D1045.420.39
E2905.330.31
F5985.110.08
G13995.110.08
H755.160.13
I5185.370.35
J1415.240.21
K6904.69-0.34
L5375.140.11
M6885.310.28
N7265.270.25
O14534.99-0.04
P3584.96-0.07
Q2945.590.56
R2225.740.71
S585.160.13
T555.580.55
U515.390.36
V595.850.82
W7445.370.34
Total144865.270.17
mh2587
Super User
Super User

Variance to overall average = [Average survey score] - CALCULATE(AVERAGE([Average survey score]), ALL('YourTable'))

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!