Skip to main content
cancel
Showing results for 
Search instead 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

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
v-binbinyu-msft
Community Support
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

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
v-binbinyu-msft
Community Support
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

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
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors