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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculating the Difference between two averages

Hello!

I would like to ask you for some advices how to calculate one new measure based on column rebate average%, MSE SD%, Total SD% seperately. 

 

Example based on total SD% column:

1. Average for all chains is 12,6%

2. For chain "A" total SD% is 3.4%, for chain B is 23.3% and so on...

3. I would like to calculate difference between total sd% per each chain and average total sd% ---> first chain "A" --> 3.4% - total average (12.6%). PLease note that this total average changes between period. 

 

Natalia_987_0-1657801979256.png

Could you please assist?

Thanks 

Natalia

 

1 ACCEPTED SOLUTION
BarnabasToth
Resolver I
Resolver I

Hi there,

You can use this approach (see link for file😞

Difference compared to average =

VAR AverageOfValue = AVERAGE('Table'[Value])

VAR AverageOfTotal = 
CALCULATE(
    AVERAGE('Table'[Value]),
    ALLSELECTED('Table'[Chain])
)

VAR Result = AverageOfValue - AverageOfTotal

RETURN
Result

 

Using ALLSELECTED changes the average at the total row in case only a subset of chains are selected.

If this answers your question, please mark this as a solution.

Regards,
Barna

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Thanks a lot. The problem has been solved. 

 

Anonymous
Not applicable

Hi @Anonymous ,

Can you provide a simple PBIX file for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. I look forward to your response.

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

jdbuchanan71
Super User
Super User

Then there is something in your [Total SD [%]]] measure that is affecting the calculation.  Can you share a sample .pbix with dummy data so we can see the data model?

In my sample file the measure work as expected:

jdbuchanan71_0-1657806230974.png

 

BarnabasToth
Resolver I
Resolver I

Hi there,

You can use this approach (see link for file😞

Difference compared to average =

VAR AverageOfValue = AVERAGE('Table'[Value])

VAR AverageOfTotal = 
CALCULATE(
    AVERAGE('Table'[Value]),
    ALLSELECTED('Table'[Chain])
)

VAR Result = AverageOfValue - AverageOfTotal

RETURN
Result

 

Using ALLSELECTED changes the average at the total row in case only a subset of chains are selected.

If this answers your question, please mark this as a solution.

Regards,
Barna

jdbuchanan71
Super User
Super User

What does this measure give you?

Total SD % ALLSELECTED =
CALCULATE ( [Total SD [%]]], ALLSELECTED ( 'Lookup_customers (2)'[Chain] ) )

On every row that should give you the 12.6% total.

Anonymous
Not applicable

Unfortunately, I can't see the same numbers: 

Natalia_987_0-1657805453662.png

Natalia_987_1-1657805699669.png

 

Anonymous
Not applicable

Hi, I believe it's not working correctly.

Please take a look at the snip attached below:

Natalia_987_1-1657804068581.png

 

Natalia_987_2-1657804251972.png

 

Thanks 

Natalia

 

jdbuchanan71
Super User
Super User

@Anonymous 

Try a measure like this.

Diff =
[Total SD %] - CALCULATE ( [Total SD %], ALLSELECTED ( 'Table'[Chain] ) )

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.