Forum Discussion

Lorenzo's avatar
Lorenzo
Silver Contributor
Jul 15, 2023
Solved

DAX: Count items if a condition is met

Hi   Relates to Counting with multiple criteria. Looked at a PowerPivot option and whilst it appears to work it seems overcomplicated to me and probably not efficient     In Table1 we have...
  • SergeiBaklan's avatar
    Jul 15, 2023

    Lorenzo 

    Not sure about efficiency, as variant

    Available:=COUNTROWS (
        FILTER (
            VALUES ( Table1[Name] ),
            CALCULATE ( COUNTROWS ( DISTINCT ( Table1 ) ), ALL ( Table1[Certification] ) ) > 1
        )
    )
    
    Total Available:=IF (
        HASONEVALUE ( Table1[Certification] ),
        [Available],
        SUMX ( VALUES ( Table1[Certification] ), [Available] )
    )

    which gives

     

Resources