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
tasmiaa
Advocate I
Advocate I

DAX to aggregate and filter

I'm trying to write dax to calculate the number of people who went skiing and scored an average of 3 or above. The average is calculated for all tricks. This would mean that Bob = 4.5, Jim = 3, Alan = 4, and Jen  = 1. The number of people above a 3 average is 3 people.  

 

For the sample table below, that would be 

 

ex.PNG

 

Unfortunately, my DAX is giving me 4 people, because Bob is being double counted. 

 

DAX I've written: 

Skiiers above average of 3 = CALCULATE(DISTINCTCOUNT(Name,
filter('Ski',Average([Score]) >= 3), All([Activity]))

 

I tried using All([Tricks]) as well & I've tried AllEXCEPT on Tricks and Activity, but I cannot keep Bob from being counted twice. 

 

Could someone please provide me with some insight?

 

Thanks!

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @tasmiaa,

 

Please try this measure:

Skiiers above average of 3 =
CALCULATE (
    DISTINCTCOUNT ( [Name] ),
    FILTER (
        'Ski',
        CALCULATE ( AVERAGE ( [Score] ), ALLEXCEPT ( ski, ski[Name] ) ) >= 3
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @tasmiaa,

 

Please try this measure:

Skiiers above average of 3 =
CALCULATE (
    DISTINCTCOUNT ( [Name] ),
    FILTER (
        'Ski',
        CALCULATE ( AVERAGE ( [Score] ), ALLEXCEPT ( ski, ski[Name] ) ) >= 3
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! 

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.