Forum Discussion
How to find duplicate values in one column while another column has different values?
- Anonymous2 years ago
Hi JonKho ,
Based on the information you have provided, it appears that you are trying to identify records that do not have duplicate values in the [merged columns]?
If yes, please refer to the m code below to group and count the table by [Merge Columns] and then filter the count to find the matching records.let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSwNDNW0gHSBmASyAMxY3UgUoYoUobIUiBdRghdRsRJgQw0RhhoTEAqFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Controller_Node_Id = _t, BarCode = _t, #"Merged Column" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Controller_Node_Id", Int64.Type}, {"BarCode", Int64.Type}, {"Merged Column", Int64.Type}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Merged Column"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"Data", each _, type table [Controller_Node_Id=nullable number, BarCode=nullable number, Merged Column=nullable number]}}), #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Controller_Node_Id", "BarCode"}, {"Controller_Node_Id", "BarCode"}) in #"Expanded Data"Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
- 2 years ago
Hi,
Write this calculated column formula
Column = if(CALCULATE(DISTINCTCOUNT(Data[Controller_Node_Id]),FILTER(Data,Data[BarCode]=EARLIER(Data[BarCode])))>1,"Duplicate","Unique")Hope this helps.
Hi JonKho ,
Based on the information you have provided, it appears that you are trying to identify records that do not have duplicate values in the [merged columns]?
If yes, please refer to the m code below to group and count the table by [Merge Columns] and then filter the count to find the matching records.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSwNDNW0gHSBmASyAMxY3UgUoYoUobIUiBdRghdRsRJgQw0RhhoTEAqFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Controller_Node_Id = _t, BarCode = _t, #"Merged Column" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Controller_Node_Id", Int64.Type}, {"BarCode", Int64.Type}, {"Merged Column", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Merged Column"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"Data", each _, type table [Controller_Node_Id=nullable number, BarCode=nullable number, Merged Column=nullable number]}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Controller_Node_Id", "BarCode"}, {"Controller_Node_Id", "BarCode"})
in
#"Expanded Data"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
- JonKho2 years agoFrequent Visitor
Hi Gao
Thank you for the reply. After much thinking and testing of concept.
The conditions for detecting the rows that I want are:
1) Detecting the same bar code of '100' then
2) detecting the different values under column, 'Controller_Node_Id'
Controller_Node_Id BarCode 10963 100 10961 100 Thank you for the help.
I will keep your solution in mind and I believe I can use it in the near future.