Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

DISTINCT count for first value DAX

Help me to create the calculated column for the DISTINCT count for first value DAX   if id repeats multiple time we have to consider as 1   ID Result 69260 1 69260 0 69260 0 69...
  • v-eachen-msft's avatar
    6 years ago

    Hi Anonymous ,

     

    At first, you need to add an index column in the query editor.

    Then you could create a new column to get the result.

    Column =
    VAR a =
        CALCULATE (
            FIRSTNONBLANK ( 'Table'[ID], 1 ),
            FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
        )
    RETURN
        IF ( a = 'Table'[ID], 0, 1 )