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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
Most Valuable Professional
Most Valuable Professional

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
Most Valuable Professional
Most Valuable Professional

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors