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
Anonymous
Not applicable

Count Above Average

Can anyone please advise on what is the correct way of writing a DAX query for count above average? I've tried the following syntax, but it doesn't seem to be working:

 

measureAverage =
VAR averageRevenue =
CALCULATE ( AVERAGE ( 'Query2'[DaysDiff] ), ALL ( 'Query2' ) )
RETURN
IF ( SUM ( 'Query2'[DaysDiff] ) >= averageRevenue, SUM ( 'Query2'[DaysDiff] ) )

 

The visual just shows (Blank)

 

Thanks

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this pattern

 

measureAverage =
VAR averageRevenue =
    CALCULATE ( AVERAGE ( 'Query2'[DaysDiff] ), ALL ( 'Query2' ) )
RETURN
    COUNTX (
        FILTER (
            ALL ( 'Query2' ),
            CALCULATE ( SUM ( 'Query2'[DaysDiff] ) ) >= averageRevenue
        ),
        1
    )

 


Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Thank you @Zubair_Muhammad, however it isn't showing the data tha I'm after. I have a table with customers and their daysover due. I'm running an average measure to find the average, but I need to find out which customers are going above the average days overdue. Have you got an idea how to solve this?

Hi @Anonymous

 

Could you share some data sample and expected output? You can upload it to OneDrive or Dropbox and post the link here.

 

Regards,

Cherie

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

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.