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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sveygal
Frequent Visitor

How do I show the same average calculation against each category?

Hey guys, 


I need some help to figure out how I can achieve this desired behaviour in my measure. 

I have a measure calculating the National Average GP % across all of our branches: 

National Average GP% = 
    AVERAGEX(
    CALCULATETABLE(
        SELECTCOLUMNS(
            DISTINCT(BRANCHES[BRANCHNO]), 
            "BRANCHES", BRANCHES[BRANCHNO], 
            "Branch Margin", [Margin %]
        )
    ), 
    [Branch Margin]
)

The [Margin %] measure is a simple calculation:

Margin % = ([Total Sales]-[Total Cost])/[Total Sales]

This measure in a card visual gives us the average GP % value we expect. 

 

The problem is that I want to put this measure into a table with each [BRANCHNO] and have the measure show the same National Average GP % in each line. As you'd expect, it's producing the [Margin %] calculation or each branch. 


What I'm getting: 
Branch | National Average GP % 
0          |  41.5

1          |  53.6

2          |  39.2

3          |  44.9


What I'm looking for:

Branch | National Average GP % 
0          |  44.8

1          |  44.8

2          |  44.8

3          |  44.8


What do I need to do to achieve this? 

Thank you for help,

Swaren Veygal

5 REPLIES 5
v-xicai
Community Support
Community Support

Hi @sveygal ,

 

You may create measure like DAX below.

 

National Average GP% = AVERAGEX(ALL(BRANCHES), [Margin %])

 

Best Regards,

Amy

 

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

Hi @v-xicai and @Anonymous ,

 

thank you very much for your help, however both your solutions come to the same outcome. I'm still not able to get the same national average value on every row in the table against each branch. 

 

I'll upload some sample data when I'm back at my desk, if you'd like to have another go at it. 

 

Thank you, 


Swaren Veygal

Anonymous
Not applicable

Hi @sveygal  , 

If I understand correctly, this should work:

National Average GP% = CALCULATE( [Margin %] , ALLEXCEPT( 'BRANCHES'[BRANCHNO] ))

Let me know how that goes.

Cheers,
Rob

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

Unfortunately, this doesn't seem to the solve the problem. This measure ends up performing the [margin %] calculation for each branch and ignores the branch in context. 

Thank you for your help anyway. 

Anonymous
Not applicable

I think you are close to the correct result.

Maybe try this one: 

National Average GP% = 
    AVERAGEX(
    CALCULATETABLE(
        SELECTCOLUMNS(
            DISTINCT(BRANCHES[BRANCHNO]), 
            "BRANCHES", BRANCHES[BRANCHNO], 
            "Branch Margin", [Margin %]
        ),
      ALLEXCEPT( 'BRANCHES'[BRANCHNO])
    ), 
    [Branch Margin]
)

If that does not work please share sample data 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors