Forum Discussion

lynnsop's avatar
lynnsop
Helper I
5 years ago
Solved

Check for string in duplicate rows

Hello, I need some help. Here is what I am trying to aim for: Lets say I have this table: Server1 Compliant Server1 Compliant Server1 Compliant Server2 Compliant Server2 N...
  • jdbuchanan71's avatar
    5 years ago

    lynnsop 

    Give these a try.

     

    Non-Compliant = 
    CALCULATE(
        DISTINCTCOUNT('Table'[Server]),
        'Table'[Result] = "Non-Compliant"
    )
    Compliant = 
    VAR _Non =
        CALCULATETABLE ( VALUES ( 'Table'[Server] ), 'Table'[Result] = "Non-Compliant" )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'Table'[Server] ),
            EXCEPT ( VALUES ( 'Table'[Server] ), _Non )
        )

     

    You should also be able to do the Compliant like this.

    Compliant = 
    DISTINCTCOUNT('Table'[Server]) - [Non-Compliant]

    Just subtracting the non-compliant count from the total count.