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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
raprabhakaran
Frequent Visitor

Aggregate non-matching values

Update 16/04

Hello Community,

I just realiased the title Remove Matching Rows & Aggregate non-matching values may be misleading and not required for my solution. Below is the updated requirement:

 

I am working on a system migration project. I have two table one from legacy system and another from the new system. Both tables should ideally contain identical values as they are standardized.

 

My challenge: 

I'd like to create a new query within Power Query - that compares the values in LegacyTable with that of NewSysTable. The common identifier between both the table will be Row_ID.

Below is tabular representation of my expected output:

 

Row_IDColumn_1Column_2
113101
113301
113600

 

1  =  Indicates a mismatch between the Column value corresponding to the Row_ID in both tables

0 = Indicates a successful migration, where the column values corresponding to the Row_ID match and can be disregarded from error aggregation

 

Based on the below two inputs:

 

LegacyTable

Row_IDColumn_1Column_2
1131AppleOrange
1133KaleBanana
1136PapaRomeo

 

NewSysTable

Row_IDColumn_1Column_2
1131AppleBanana
1133KaleOrange
1136PapaRomeo

 

 

Thanks in advance for your help and guidance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @lbendlin 

Hi, @raprabhakaran 

Have you solved the current problem? Based on the sample data you provide and the output you expect, I do this by the following method:

LegacyTable

vjianpengmsft_0-1713843235637.png

NewSysTable

vjianpengmsft_1-1713843266596.png

I've created two measures as follows:

column1 =
VAR _id =
    SELECTEDVALUE ( LegacyTable[Row_ID] )
VAR _column1_of_LegacyTable =
    CALCULATE ( MAX ( 'LegacyTable'[Column_1] ), 'LegacyTable'[Row_ID] = _id )
VAR _column1_of_NewSysTable =
    CALCULATE ( MAX ( 'NewSysTable'[Column_1] ), 'NewSysTable'[Row_ID] = _id )
RETURN
    IF ( _column1_of_LegacyTable = _column1_of_NewSysTable, 0, 1 )
column2 =
VAR _id =
    SELECTEDVALUE ( LegacyTable[Row_ID] )
VAR _column2_of_LegacyTable =
    CALCULATE ( MAX ( 'LegacyTable'[Column_2] ), 'LegacyTable'[Row_ID] = _id )
VAR _column2_of_NewSysTable =
    CALCULATE ( MAX ( 'NewSysTable'[Column_2] ), 'NewSysTable'[Row_ID] = _id )
RETURN
    IF ( _column2_of_LegacyTable = _column2_of_NewSysTable, 0, 1 )

I put these two measures and the Row_ID columns of LegacyTable into a table visual, and the result is as follows:

vjianpengmsft_2-1713843502763.png

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

What exactly are you trying to compare? Column types or cell contents?

Hi @lbendlin 

I am trying to compare the values. 

For Eg: 

LegacyTable

Row_IDColumn_1Column_2
1131AppleOrange
1133KaleBanana
1136PapaRomeo

 

NewSysTable

Row_IDColumn_1Column_2
1131AppleBanana
1133KaleOrange
1136PapaRomeo

 

Expected Output

Row_IDColumn_1Column_2
113101
113301
113600

 

Thanks for the help!

Hi,

Merge into Table1, data from Table2.  Merge as a new Table.  The connecting column between both tables will be the ID column.  In the Query Editor, write a custom formula to check if Column_1=Column_1.1.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks @lbendlin 

Hi, @raprabhakaran 

Have you solved the current problem? Based on the sample data you provide and the output you expect, I do this by the following method:

LegacyTable

vjianpengmsft_0-1713843235637.png

NewSysTable

vjianpengmsft_1-1713843266596.png

I've created two measures as follows:

column1 =
VAR _id =
    SELECTEDVALUE ( LegacyTable[Row_ID] )
VAR _column1_of_LegacyTable =
    CALCULATE ( MAX ( 'LegacyTable'[Column_1] ), 'LegacyTable'[Row_ID] = _id )
VAR _column1_of_NewSysTable =
    CALCULATE ( MAX ( 'NewSysTable'[Column_1] ), 'NewSysTable'[Row_ID] = _id )
RETURN
    IF ( _column1_of_LegacyTable = _column1_of_NewSysTable, 0, 1 )
column2 =
VAR _id =
    SELECTEDVALUE ( LegacyTable[Row_ID] )
VAR _column2_of_LegacyTable =
    CALCULATE ( MAX ( 'LegacyTable'[Column_2] ), 'LegacyTable'[Row_ID] = _id )
VAR _column2_of_NewSysTable =
    CALCULATE ( MAX ( 'NewSysTable'[Column_2] ), 'NewSysTable'[Row_ID] = _id )
RETURN
    IF ( _column2_of_LegacyTable = _column2_of_NewSysTable, 0, 1 )

I put these two measures and the Row_ID columns of LegacyTable into a table visual, and the result is as follows:

vjianpengmsft_2-1713843502763.png

I've provided the PBIX file used this time below.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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