Forum Discussion

agross's avatar
agross
Regular Visitor
8 years ago
Solved

tag duplicates

Dear Community,   Thank you for adding. I am working for a flight consolidator in Germany and have been using PBI recently. I am very excited about the possibilities.    Now I am a little lost wh...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi agross,

     

    In power bi data model, it not contain column index and row index, so dax formula won't recognize first record and will mark all similar records as duplicate.

     

    In my opinion, you can add index column in query editor, then you can use below formula to loop on concatenated text and mark duplicate records.

    Duplicate = 
    VAR uniqueCount =
        CALCULATE (
            COUNT ( 'Sample'[CONCATENATE] ),
            FILTER (
                ALL ( 'Sample' ),
                [Index] <= EARLIER ( [Index] )
                    && [CONCATENATE] = EARLIER ( 'Sample'[CONCATENATE] )
                    && [Booking Date] = EARLIER ( [Booking Date] )
            )
        )
    RETURN
        IF ( uniqueCount >= 2, "Yes", "No" )
    

     

    Regards,

    Xiaoxin Sheng