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
leroy773
Helper II
Helper II

Remove rows based on duplicate value in column

Looking for a DAX formula to remove rows based on duplicate serial numbers.  I currently have a data table with multiple rows.  Some of the rows have the same serial number.  I would like to count the sum the rows, but remove rows that have the same serial number.  The formula I have currently sums up all rows.  Parts Per Year = sum('Table'[column])

 

Please help in letting me know how to modify this so it only sums/counts rows that a unique serial number.  Serial number is its own column in the same data table.

1 ACCEPTED SOLUTION

@leroy773 @mickeydjw

 

Oops!

Got it,

 

 

Tt_SerialNumber_Replace = CALCULATE(
DISTINCTCOUNT(Planilha1[serial Number]);
filter(ALL(Planilha1);Planilha1[Part Replace]=1))

 

Clipboard01.gif

 

Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
 
Best Regards,
Rfranca

View solution in original post

5 REPLIES 5
Rfranca
Resolver IV
Resolver IV

@leroy773

 

See the link below, it can help you!

 

https://www.daxpatterns.com/distinct-count/

Thanks that helped, but still having trouble.  The distinctcount showed how many rows had a unique serial number, but would like to count the number of rows with a unique serial number when a true/false condition is met in a different columnt on the table.  

Sample data below, looking for the dax formula so the rows that are counted or summed equals 5.  Only count the serial number if part replace equals 1 and only count the serial number one time.

 

serial NumberPart Replace
11
11
10
11
21
21
31
40
40
41
51
60
60

@leroy773 @mickeydjw

 

Oops!

Got it,

 

 

Tt_SerialNumber_Replace = CALCULATE(
DISTINCTCOUNT(Planilha1[serial Number]);
filter(ALL(Planilha1);Planilha1[Part Replace]=1))

 

Clipboard01.gif

 

Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
 
Best Regards,
Rfranca

Measure = CALCULATE(DISTINCTCOUNT('Table'[serial Number]),FILTER('Table','Table'[Part Replace]=1))

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.