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
asrarkhan26
Regular Visitor

Duplicate Data and its value

I have two table of same type. I want to validate Col-1 of two table and its brand name of two table. If both Brand colume value match with both table then mention matched in 3rd column otherwise not matched

Table 1

 Col-1      Brand

 Printer     Canon

 Printer     Canon

Adapter    HP

Adapter    HP

Adapter    HP

 

Table 2

Col-1         Brand 

Printer       Canon

Printer       HP

Adapter     HP

Adapter     

Adapter     Nokia

 

 

Result 

Col-1       Brand     Result

Printer     Canon     Matched

Printer      Canon    Not Matched

Adapter    HP          Matched

Adapter    HP          Not Matched

Adapter    Nokia      Matched

 

Thanks

2 ACCEPTED SOLUTIONS
tackytechtom
Super User
Super User

Hi @asrarkhan26 ,

 

How about this solution in Power Query:

tackytechtom_0-1681431421660.png

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

 

Table1 (result table):

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKzCtJLVLSUXJOzMvPU4rVwS7mmJJYABHzCCBGIBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col-1" = _t, Brand = _t]),
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
    #"Sorted Rows" = Table.Sort(#"Added Index",{{"Index", Order.Ascending}}),
    #"Merged Queries" = Table.NestedJoin(#"Sorted Rows", {"Col-1", "Brand", "Index"}, Table2, {"Col-1", "Brand ", "Index"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Index"}, {"Table2.Index"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table2", "Result", each if [Table2.Index] = null then "not matched" else "matched"),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index", "Table2.Index"})
in
    #"Removed Columns"

 

Table2:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKzCtJLVLSUXJOzMvPU4rVQRbzCAALOKYkFuAQQOP65WdnJirFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col-1" = _t, #"Brand " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col-1", type text}, {"Brand ", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)
in
    #"Added Index"

 

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

Yes, it working for me. I am delighted to see this solution. Thank You 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @asrarkhan26 ,

 

How about this solution in Power Query:

tackytechtom_0-1681431421660.png

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

 

Table1 (result table):

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKzCtJLVLSUXJOzMvPU4rVwS7mmJJYABHzCCBGIBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col-1" = _t, Brand = _t]),
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
    #"Sorted Rows" = Table.Sort(#"Added Index",{{"Index", Order.Ascending}}),
    #"Merged Queries" = Table.NestedJoin(#"Sorted Rows", {"Col-1", "Brand", "Index"}, Table2, {"Col-1", "Brand ", "Index"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Index"}, {"Table2.Index"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table2", "Result", each if [Table2.Index] = null then "not matched" else "matched"),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index", "Table2.Index"})
in
    #"Removed Columns"

 

Table2:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKzCtJLVLSUXJOzMvPU4rVQRbzCAALOKYkFuAQQOP65WdnJirFxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Col-1" = _t, #"Brand " = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col-1", type text}, {"Brand ", type text}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type)
in
    #"Added Index"

 

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Yes, it working for me. I am delighted to see this solution. Thank You 

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.