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
MacyMolly
Helper II
Helper II

Distinct Count and count the ones with an average Score of >= 90%

MacyMolly_2-1622506220708.png

Hi All, 
I'm new to powerbi. I'm trying to create a measure that will only count with Score(% Score) average of >=90% by ID. A distinct value on column "ID". Kindly refer to the attached image. Your help is greatly appreciated.

1 ACCEPTED SOLUTION

Hi @MacyMolly  try this:

NewMeasure =
VAR _distinctCount =
    DISTINCTCOUNT ( 'Table'[ID] ) //Count how many ids
VAR _summarizeTable =
    SUMMARIZECOLUMNS (
        'Table'[ID],
        'Table',
        "Average",
            IF ( AVERAGE ( 'Table'[%Score] ) >= .9, 1, 0 ) //if equal to or greater than .9 give it a 1
    )
VAR _passingCount =
    SUMX ( _summarizeTable, [Average] )
VAR _calc =
    DIVIDE ( _passingCount, _distinctCount ) //Sum the average column from the table above and divide it by the total of ids
RETURN
    _calc

 

Nathaniel_C_0-1622592689787.png

and if you just want the passing count, return _passingCount instead of _calc
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
Nathaniel_C
Community Champion
Community Champion

Hi @MacyMolly , and if you use essentially the same measure, but just return the _calc, you will have the averages.

 

myMeasureAverage = 
VAR _curID =
    MAX ( 'Table'[ID] )
VAR _calc =
    CALCULATE (
        AVERAGE ( 'Table'[%Score] ),
        FILTER ( ALLEXCEPT ( 'Table', 'Table'[ID] ), MAX ( 'Table'[ID] ) = _curID )
    )
RETURN
    _calc

 

Bonus! 

Nathaniel_C_0-1622510665537.png

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Nathaniel_C, I'm sorry. I think I wasn't able to express myself very well. Well, I only want to create a measure that will count of all the distinct ID that able to achieved an average score of >= 0.90. I have a filter that can select multi weeks.
1. distinctcount ( ID)
2. only count each distinct ID if they passed the score of >= .90
3. Get the passing rate: total count of distinct ID who passed divided by the distinctcount(ID)

Hi @MacyMolly  try this:

NewMeasure =
VAR _distinctCount =
    DISTINCTCOUNT ( 'Table'[ID] ) //Count how many ids
VAR _summarizeTable =
    SUMMARIZECOLUMNS (
        'Table'[ID],
        'Table',
        "Average",
            IF ( AVERAGE ( 'Table'[%Score] ) >= .9, 1, 0 ) //if equal to or greater than .9 give it a 1
    )
VAR _passingCount =
    SUMX ( _summarizeTable, [Average] )
VAR _calc =
    DIVIDE ( _passingCount, _distinctCount ) //Sum the average column from the table above and divide it by the total of ids
RETURN
    _calc

 

Nathaniel_C_0-1622592689787.png

and if you just want the passing count, return _passingCount instead of _calc
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




You Rock! Thank you @Nathaniel_C

Hi @MacyMolly , you are welcome!

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Nathaniel_C
Community Champion
Community Champion

Hi @MacyMolly ,

 

 

 

myMeasurecount =
VAR _curID =
    MAX ( 'Table'[ID] )
VAR _calc =
    CALCULATE (
        AVERAGE ( 'Table'[%Score] ),
        FILTER ( ALLEXCEPT ( 'Table', 'Table'[ID] ), MAX ( 'Table'[ID] ) = _curID )
    )
RETURN
    IF ( _calc >= .90, 1, 0 )

Capture6.PNG

 

 Try this.

Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.