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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jeffshieldsdev
Solution Sage
Solution Sage

Count of High Average Scores

I'm trying to figure the DAX to get the count (or sum) of "High Average Scores" (in this case, an average >= 6) but dynamic based on the other columns in the table.

I was thinking I could use a measure to return 1 if "High Average Score", otherwise 0 and then count/sum.

 

High Avg Score = IF(AVERAGE('Table'[Score]) >= 6, 1, 0)

 

I've tried a second measure using x-functions for SUM and COUNT, but my average is by related column in the table not each row, so that doesn't seem right.

You can see in the red box the "total" is 0--I'm trying to get the count, which is numbered next to each box.  Thanks for any help.2021-04-02_14h17_21.png

Count of High Average Scores Question_2021-04-02_1419.pbix

2 REPLIES 2
jeffshieldsdev
Solution Sage
Solution Sage

This approach works for a given column, thank you.

I figured I could create explicit measures for each column, but I was hoping the measure would be dynamic based on the other column(s) in the table.

2021-04-03_08h27_01.png

If not possible, this method will surely work.

 

High Avg Score category new = 
VAR newtable =
    FILTER (
        GROUPBY (
            ALL ( 'Table' ),
            'Table'[Category],
            "@avg", AVERAGEX ( CURRENTGROUP (), 'Table'[Score] )
        ),
        [@avg] >= 6
    )
RETURN
    IF (
        ISFILTERED ( 'Table' ),
        IF ( AVERAGE ( 'Table'[Score] ) >= 6, 1, 0 ),
        COUNTROWS ( newtable )
    )

 

Jihwan_Kim
Super User
Super User

Hi, @jeffshieldsdev 

I think the reason is that the last row (total row) of each table visualization is considering the whole table. This means the whole table's average is 5.53 so that is why the counting of >=6 is always zero.

And each visualization is showing a different context. So, in my opinion, the different measure has to be applied to each of the visualizations.

I wrote three measures in the sample pbix file. please kindly check.

 

Picture2.png

 

https://www.dropbox.com/s/2e38ydyvin70fo7/Count%20of%20High%20Average%20Scores%20Question_2021-04-02... 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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