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

 

IDResult
692601
692600
692600
692600
692600
684401
540981
540980
540980
540980
375811
850211
728781
627651
627650
627650
627650
627650
627650
627650
591701
500761
500760
754001
379861
379860
379860
379860
379860
565911
424991
524601
  • 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 )

     

13 Replies