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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stjimi
Frequent Visitor

Average everything else

HI All, 

I am new to Dax and I can't seem to figure out how to find the average of all values in the category without including the present row of another category. For example, I want to find the average of all controls of all other jurisdictions except the one on the row. See below. 

Sorry, I can't explain it properly. 

 

Control NumberJurisdictionAverageAverage of others 
Control 1 SA23.5
Control 1NSW33
Control 1 WA42.5
Control 2SA33.5
Control 2NSW43
Control 2WA33.5
Control 3SA75.5
Control 3NSW66
Control 3WA56.5
1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @stjimi 

From your example, it looks like a measure such as this would give the result you want:

 

Average of others = 
CALCULATE ( 
    [Average],
    EXCEPT ( 
        ALLSELECTED ( YourTable[Jurisdiction] ),
        VALUES ( YourTable[Jurisdiction] )
    )
)

 

This assumes a measure [Average] is already defined.

The EXCEPT ( ... ) expression creates a modified filter on Jurisdiction, by taking the filter on Jurisdiction applying to the overall visual, and removing the value(s) of Jurisdiction visible in the current filter context, i.e. removes the single value from the current row of your table in your example.

 

Regards,

Owen

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

3 REPLIES 3
stjimi
Frequent Visitor

Thanks so much, Owen. This makes sense.  How would I go about defining a measure for the Average? Would I do this with a 'new measure'. Sorry about the simple question. 

It would just be AVERAGE ( Table1[Column1] ) where you substitute whatever column you're wanting to average instead of my placeholder.

OwenAuger
Super User
Super User

Hi @stjimi 

From your example, it looks like a measure such as this would give the result you want:

 

Average of others = 
CALCULATE ( 
    [Average],
    EXCEPT ( 
        ALLSELECTED ( YourTable[Jurisdiction] ),
        VALUES ( YourTable[Jurisdiction] )
    )
)

 

This assumes a measure [Average] is already defined.

The EXCEPT ( ... ) expression creates a modified filter on Jurisdiction, by taking the filter on Jurisdiction applying to the overall visual, and removing the value(s) of Jurisdiction visible in the current filter context, i.e. removes the single value from the current row of your table in your example.

 

Regards,

Owen

 

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors