Forum Discussion

Shota_Xuc's avatar
Shota_Xuc
Icon for Helper I rankHelper I
2 years ago

DAX measure for finding duplicates

Hi,

 

I have this table in Power BI and a slicer connected to column 'Trade date'. I need a measure that finds duplicates in column 'Security ID' in time interval chosen by slicer. Can anyone help?

Trade dateSecurity ID
2024-05-15CITI 240515
2024-05-15GS RPW 241127
2024-05-15GS RPW 241127
2024-05-15JPM AG 241113
2024-05-15JPM AG 241113
2024-05-15UBS S 241113
2024-05-15CITI 241127
2024-05-15CITI 241127
2024-05-15JPM RPJ 241127
2024-05-15JPM RPJ 241127
2024-05-15CITI 241211
2024-05-15CITI 241211

6 Replies

  • DataNinja777 I simplified my table in my previous question, but my table has many columns besides 'Sequrity ID' column and I I want to find duplicates only in 'Security ID' column. Your solution does not work for tables with many columns.

      • Shota_Xuc's avatar
        Shota_Xuc
        Icon for Helper I rankHelper I

        Hi Anonymous thanks, I found solution to find duplicates and it works good, below DAX:

        Duplicate Sec ID =
        VAR CountSecID = COUNTROWS(
            FILTER(
                ALLSELECTED(DM_TRANSACTIONS_CURRENT_YEAR),
                DM_TRANSACTIONS_CURRENT_YEAR[Security ID] = MAX(DM_TRANSACTIONS_CURRENT_YEAR[Security ID])
            )
        )
        RETURN
            IF(CountSecID > 2,
            "Duplicate",
            "OK")
  • DataNinja777 countrows only works when you have one column in the table, but I had more columns and needed to count duplicates in a certain column.