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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
PowerBI_Query
Helper II
Helper II

Compare Tables to Find Different Rows

I have two tables one has old data and the other has latest data.

I need to compare both and identify numbers that needs update.

Each number can have 1 to 50 unique descriptions within each cell separated by a line feed in any order.

The string length of the each unique description can vary from 4 to 350 characters.

If possible, I need Removed and Added description details for each number in the comparison table along with the status.

The below screenshot does not cover every scenario it gives a general idea how the comparison output would look like.

compare.png

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Solution Excel file uploaded to https://1drv.ms/x/s!Akd5y6ruJhvhuWM_E7x4impYGs_w?e=xOVN1N 

The query used for Table1

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numbers", type text}, {"Description", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Numbers"}, Table2, {"Numbers"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Description"}, {"Description.1"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table2", "Removed", each Text.Combine(List.Difference(Text.Split([Description],"#(lf)"),Text.Split([Description.1],"#(lf)")),"#(lf)"), type text),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Added", each Text.Combine(List.Difference(Text.Split([Description.1],"#(lf)"),Text.Split([Description],"#(lf)")),"#(lf)"), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Description.1"}),
    #"Replaced Value" = Table.ReplaceValue(#"Removed Columns","","None",Replacer.ReplaceValue,{"Removed", "Added"}),
    #"Added Custom2" = Table.AddColumn(#"Replaced Value", "Custom", each if [Removed]="None" and [Added]="None" then "No Change" else "Update")
in
    #"Added Custom2"

 

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Solution Excel file uploaded to https://1drv.ms/x/s!Akd5y6ruJhvhuWM_E7x4impYGs_w?e=xOVN1N 

The query used for Table1

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Numbers", type text}, {"Description", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Numbers"}, Table2, {"Numbers"}, "Table2", JoinKind.LeftOuter),
    #"Expanded Table2" = Table.ExpandTableColumn(#"Merged Queries", "Table2", {"Description"}, {"Description.1"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Table2", "Removed", each Text.Combine(List.Difference(Text.Split([Description],"#(lf)"),Text.Split([Description.1],"#(lf)")),"#(lf)"), type text),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Added", each Text.Combine(List.Difference(Text.Split([Description.1],"#(lf)"),Text.Split([Description],"#(lf)")),"#(lf)"), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Description.1"}),
    #"Replaced Value" = Table.ReplaceValue(#"Removed Columns","","None",Replacer.ReplaceValue,{"Removed", "Added"}),
    #"Added Custom2" = Table.AddColumn(#"Replaced Value", "Custom", each if [Removed]="None" and [Added]="None" then "No Change" else "Update")
in
    #"Added Custom2"

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Kudoed Authors