Forum Discussion

lmh100's avatar
lmh100
New Member
8 years ago
Solved

Count distinct values by date

Hi,    I am trying to create a calculated column in a table - based on counted distinct values that appear during the month - an example of the table is below:   Date Unique value Count requ...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi lmh100

     

    Try this column

     

    Count Required =
    CALCULATE (
        COUNT ( TableName[Unique value] ),
        FILTER (
            ALLEXCEPT ( TableName, TableName[Unique value] ),
            MONTH ( TableName[Date] ) = MONTH ( EARLIER ( TableName[Date] ) )
        )
    )

     

    or this one

     

    Count Required =
    CALCULATE (
        COUNT ( TableName[Unique value] ),
        ALLEXCEPT ( TableName, TableName[Unique value], TableName[Date].[Month] )
    )