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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.