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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jonasr
Advocate I
Advocate I

calculate measure as an individual deviance from average

Hi all,

 

I am trying to calculate new measure as a deviation of individual ratio from the overall average ratio across all individuals. It will be displayed in a bar chart and the number of rows will depend on some other attribute slicers so it needs to be a measure so that it can change dynamically.

 

Example data:

 

Person | home_p
xxx       | 1
xxx       | 0
xxx       | 1
xxx       | 0
xxx       | 1
yyy       | 1
yyy       | 1
yyy       | 1
yyy       | 1
yyy       | 1
aaa       | 1
aaa       | 1
aaa       | 1
bbb       | 0
bbb       | 0
bbb       | 0


 

 

The first part is simple

 

home_p_rate = SUM('score'[home_p])/COUNT('score'[home_p])

 

which gives me the individual ratios in the bar chart.

 

Now I need to add something like this to get the deviance from overall average:

 

home_p_rate_dev = SUM('score'[home_p])/COUNT('score'[home_p]) - AverageAcrossAllIndividuals( SUM('score'[home_p])/COUNT('score'[home_p]) )

 

Any idea how to approach this?

 

Thanks

 

Jonas 

 

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft Employee
Microsoft Employee

@jonasr

 

In this scenario, you can use below measure formula to get the deviance from overall average.

 

home_p_rate_dev = 
VAR AverageAcrossAllIndividuals =
    CALCULATE ( AVERAGE ( score[home_p] ), ALL ( score ) )
RETURN
( [home_p_rate] - AverageAcrossAllIndividuals )

calculate measure as an individual deviance from average_1.jpg

 

Best Regards,

Herbert

View solution in original post

2 REPLIES 2
v-haibl-msft
Microsoft Employee
Microsoft Employee

@jonasr

 

In this scenario, you can use below measure formula to get the deviance from overall average.

 

home_p_rate_dev = 
VAR AverageAcrossAllIndividuals =
    CALCULATE ( AVERAGE ( score[home_p] ), ALL ( score ) )
RETURN
( [home_p_rate] - AverageAcrossAllIndividuals )

calculate measure as an individual deviance from average_1.jpg

 

Best Regards,

Herbert

Very simple and nice solution. Thank you!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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