Forum Discussion

amuola's avatar
amuola
Icon for Helper II rankHelper II
8 years ago
Solved

Distinct count based on a criteria from another column

  Hi, I would like to count the number of distinct “Req nr” that has not got any “Book nr” at all. Each row in the Table corresponds to a certain activity in the process, and at some time the Req n...
  • v-yulgu-msft's avatar
    8 years ago

    Hi amuola,

     

    You could add below measure to a card visual to show result.

    DistinctCount =
    CALCULATE (
        DISTINCTCOUNT ( 'Book record'[Req nr] ),
        FILTER (
            ALL ( 'Book record' ),
            CALCULATE (
                COUNT ( 'Book record'[Book nr] ),
                FILTER (
                    ALLEXCEPT ( 'Book record', 'Book record'[Req nr] ),
                    'Book record'[Book nr] <> BLANK ()
                )
            )
                = BLANK ()
        )
    )

     

    Best regards,

    Yuliana Gu