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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Checking for different values in duplicates

Good day all,

 

I have a table in Power Bi that looks similar to this:

Randolph_0-1615880899618.png

What I need to get is a column called Age_Check that would output 1 if for every group of records with the same name where there is a difference in age. 

 

Bassicaly, Age_Check should output 0 for all records that do not have a Name repeating (i.e Name_Count is 1) and only process those records that have duplicate names (i.e Name_Count >1). For those duplicates that have different value for Age, the Age_Check should be equal to 1.

1 ACCEPTED SOLUTION

@Anonymous , Seem like missed age logic, Try this

 

Age_check =
var _1 = countx(filter(Table,table[Name] = earlier(Table[Name])),Table[Name])
var _2 = countx(filter(Table,table[Name] = earlier(Table[Name]) && table[Age] = earlier(Table[age])),Table[Name])
return
if(_1 >1 && _1<> _2 ,1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

@Anonymous , create a new column like

new column = if(countx(filter(Table,table[Name] = earlier(Table[Name])),Table[Name])>1,1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Please could you input the column names I used in my Example data.

@Anonymous , You have used a name, I used the same

Age_check = if(countx(filter(Table,table[Name] = earlier(Table[Name])),Table[Name])>1,1,0)

 

or we can use ID

 

Age_check = if(countx(filter(Table,table[ID] = earlier(Table[ID])),Table[ID])>1,1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thank you for the solution, but it does not address the Age factor. I have tested it and what your solution does is to mark all records with duplicate Name as 1. However I need it to check if Age is the same for all cases where Name is duplicated. As I explained, if Name is duplicated it should check all instaces of age and if there is a difference in the age then it should record 1 for all the affected records. 

@Anonymous , Seem like missed age logic, Try this

 

Age_check =
var _1 = countx(filter(Table,table[Name] = earlier(Table[Name])),Table[Name])
var _2 = countx(filter(Table,table[Name] = earlier(Table[Name]) && table[Age] = earlier(Table[age])),Table[Name])
return
if(_1 >1 && _1<> _2 ,1,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

This worked! Appreciate the support

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.