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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rmba22875
Frequent Visitor

Identifying Duplicates

We are currently trying to replicate some reporting we already do in excel and use Power BI instead and have hit a snag.

Our data contains 2 identifying markers which we call Home and Away and make up a relationship which look like: 

AE001/AE002
AE001/AE004
AE001/AE005
AE001/AE006
AE001/AE008
AE001/AE009
AE001/AE010
AE001/AE012
AE002/AE001

 

These are always in alphabetical order and we currently use the following formula to identify duplicates.
=IF(ISERROR(INDEX($F$1:F1,MATCH(RIGHT(F2,5)&"/"&LEFT(F2,5),$F$1:F1,0))),"","Duplicate")

 

Is there something similar that can be done in PowerBI?

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @rmba22875 ,

 

Here are the steps you can follow:

1. In Power Query -- Add Column – Index Column – From 1.

vyangliumsft_0-1678239650623.png

2. Create calculated column.

 

Column 2 =
var _right=
VALUE(RIGHT([Column],3))
var _left=
VALUE(MID([Column],3,3))
return
IF(
    _left>_right,    
      RIGHT([Column],5)&"/"&LEFT([Column],5),
      LEFT([Column],5)&"/"&RIGHT([Column],5))

 

Column 3 = 
var _select=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Index]<>EARLIER('Table'[Index])),"1",[Column 2])
return
IF(
    'Table'[Column 2] in _select ,"Duplicate","")

3. Result:

vyangliumsft_2-1678239650626.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi  @rmba22875 ,

 

Here are the steps you can follow:

1. In Power Query -- Add Column – Index Column – From 1.

vyangliumsft_0-1678239650623.png

2. Create calculated column.

 

Column 2 =
var _right=
VALUE(RIGHT([Column],3))
var _left=
VALUE(MID([Column],3,3))
return
IF(
    _left>_right,    
      RIGHT([Column],5)&"/"&LEFT([Column],5),
      LEFT([Column],5)&"/"&RIGHT([Column],5))

 

Column 3 = 
var _select=SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Index]<>EARLIER('Table'[Index])),"1",[Column 2])
return
IF(
    'Table'[Column 2] in _select ,"Duplicate","")

3. Result:

vyangliumsft_2-1678239650626.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

AmiraBedh
Super User
Super User

Try the following : 

= IF( CALCULATE( COUNTROWS(Table1), FILTER( Table1, Table1[Home] = EARLIER( Table1[Home] ) && Table1[Away] = EARLIER( Table1[Away] ) ) ) > 1, "Duplicate", "" )


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Given it a go and not working. I am using a column with the home and away values concatenated such as AE001/AE002 so the duplicate would be AE002/AE001.

 

Duplicate = if(CALCULATE(COUNTROWS('Consolidated Summary'),FILTER('Consolidated Summary','Consolidated Summary'[Consolidated Home Relationship]=EARLIER(right('Consolidated Summary'[Consolidated Home Relationship],5&"/"&LEFT('Consolidated Summary'[Consolidated Home Relationship],5),>1,"Duplicate")
YukiK
Impactful Individual
Impactful Individual

This should be done in Power Query if you're looking to remove duplicates. Go to query editor and you'll a plenty of data manipulation options there

 

If not, would you elaborate what you're trying to achieve? Are you trying to add a column that identifies duplicates?

Yes we need to apply a column that identifies the duplicates. This is so we can then manipulate the data as we need too as sometimes we need to look at it as a whole and other times without the duplicates.


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.