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! Request now

Reply
marcelmunk
Frequent Visitor

Find duplicate in one column and then return column that don't match

Hi,

Please, I need some help.

I have items with a series of duplicated columns, and one that don't match. I want Power BI to tell me which column is not a duplicate. (See example data below, in which I used only 4 columns to simplify)

 

Input:

ProductColorSizeSlim
ABCBlueSY
ABCBlueSN
DEFRedMY
XYZBlueLY
XYZBlueMY
KLMBlackMY
KLMWhiteMY

 

Desired result:

ProductDiffColumn
ABCSlim
XYZSize
KLMColor

 

Thanks in advamce,

Marcel

2 REPLIES 2
Anonymous
Not applicable

Hi @marcelmunk ,

 

There seems to be no easy or smart way to fix it. I can only think of a step-by-step calculation to get it.

DupColor = var _count1=COUNTROWS(FILTER('Table',[Product]=EARLIER('Table'[Product])))
var _count2=COUNTROWS(FILTER('Table',[Color]=EARLIER('Table'[Color])&&[Product]=EARLIER('Table'[Product])))
var _maxcount2=MAXX(FILTER('Table',[Product]=EARLIER('Table'[Product])),_count2)
return IF(_count1=_maxcount2,"Duplicated","Color")
DupSize = var _count1=COUNTROWS(FILTER('Table',[Product]=EARLIER('Table'[Product])))
var _count2=COUNTROWS(FILTER('Table',[Size]=EARLIER('Table'[Size])&&[Product]=EARLIER('Table'[Product])))
var _maxcount2=MAXX(FILTER('Table',[Product]=EARLIER('Table'[Product])),_count2)
return IF(_count1=_maxcount2,"Duplicated","Size")
DupSlim = var _count1=COUNTROWS(FILTER('Table',[Product]=EARLIER('Table'[Product])))
var _count2=COUNTROWS(FILTER('Table',[Slim]=EARLIER('Table'[Slim])&&[Product]=EARLIER('Table'[Product])))
var _maxcount2=MAXX(FILTER('Table',[Product]=EARLIER('Table'[Product])),_count2)
return IF(_count1=_maxcount2,"Duplicated","Slim")
DiffColumn = IF([DupColor]="Duplicated",IF([DupSize]="Duplicated",IF([DupSlim]="Duplicated",BLANK(),[DupSlim]),[DupSize]),[DupColor])

vstephenmsft_1-1659086318296.png

vstephenmsft_2-1659086327401.png

 

 

Best Regards,

Stephen Tao

 

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

Thanks for the answer, @Anonymous !

 

I wander if there's a more elegant (and general) solution.

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