Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Shota_Xuc
Helper I
Helper I

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 6
Shota_Xuc
Helper I
Helper I

@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.

Shota_Xuc
Helper I
Helper I

@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.

Anonymous
Not applicable

Hi @Shota_Xuc ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

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")
Anonymous
Not applicable

HI @Shota_Xuc,

I'm glad to hear you find the solution and share the expression here, I think they should help other users who faced the similar scenario.

Regards,

Xiaoxin Sheng

DataNinja777
Super User
Super User

Hi @Shota_Xuc ,

 

You can simply write a countrows dax formula like below, and bring 'Security ID' in the rows of your matrix table and put [Countrows] measure in the matrix to get the output you are after.  

DataNinja777_0-1716208174607.png

I attach the simple example pbix file. 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors