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
SAU1111
Frequent Visitor

Remove Duplicates not working and M code for counting duplicates in a new column is required

Hello All,

 

I am trying to remove duplicates from Serial Number column but still few are left . Why remove dublicates are not working please find below the M code :-

 

#"Sorted Rows" = Table.Sort(#"Filtered Rows5",{{"Serial_Number", Order.Ascending}}),
#"Buffer Table" = Table.Buffer(#"Sorted Rows"),
#"Removed Duplicates" = Table.Distinct(#"Buffer Table", {"Serial_Number"}),

 

 

before this still i have to remove :

#"Filtered Rows5" = Table.SelectRows(#"Filtered Rows2", each [Serial_Number] <> "XXXX" and [Serial_Number] <> "DELETED" and [Serial_Number] <> "V0147" and [Serial_Number] <> "Delete" and [Serial_Number] <> "DUMMY" and [Serial_Number] <> "DUPLICATE" and [Serial_Number] <> "ERROR" and [Serial_Number] <> "FB0383" and [Serial_Number] <> "DUPLICIDADE" and [Serial_Number] <> "N/A" and [Serial_Number] <> "ABC" and [Serial_Number] <> "ABCD" and [Serial_Number] <> "xyz Regions" and [Serial_Number] <> "C" and [Serial_Number] <> "A" and [Serial_Number] <> "UNKNOWN" and [Serial_Number] <> "NA" and [Serial_Number] <> "N A" and [Serial_Number] <> "X4FL62J87395"),

 

Why power Query is passing these through ?What to do and in order to find these i worte a DAX code to check if still Duplicates are avaialble - 

Dublicate = CALCULATE(COUNT('Product Group'[Serial_Number]),FILTER('Product Group','Product Group'[Serial_Number] =EARLIER('Product Group'[Serial_Number])))
 
after checking this i have to come back to Query editor and filter specific serial numbers .
 
Please suggest an M code so that it can count those dupliactes as a seperate column and later on filter it .
 
 

 

1 REPLY 1
Anonymous
Not applicable

Hi @SAU1111 ,

 

I try to reproduce it.

vstephenmsft_3-1670550934005.png

And my result is right.

vstephenmsft_2-1670550926857.png

If possible, please provide some sample data and expected result.

 

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.

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.