Power BI: compare tables for new data or duplicate

In this article, I will explain how I check for new data by comparing 2 tables but I can use the same process to check for duplicate values. I have those data:

old data new data
power bi power bi

I want to know 2 things: the new problem (PRB5) and the new incident tickets related to the problem (PRB1 with INC002 and PRB4 with INC006). Now, if I don’t care about the relationship between both, go to the “without relationship” section.

With relationship

First, I want to have unique values in a new column since both columns have duplicate so for each table, I will combine the 2 columns with this formula:

[argument1]&"_"&[argument2]

power bi

NOTE:

old data new data
power bi power bi

In the “new data” table, I will create another new column to show new problem tickets but also new incident tickets with this formula:

var value3=IF(ISBLANK(LOOKUPVALUE('table1'[argument1],'table1'[argument1],'table2'[argument1])),"value1")
Return
IF(ISBLANK(value3),IF(ISBLANK(LOOKUPVALUE('table1'[argument2],'table1'[argument2],'table2'[argument2])),"value2"),value3)

power bi

This is the final result:

power bi

In the other hand, to show duplicate, I will use this formula:

var value3=IF(NOT(ISBLANK(LOOKUPVALUE('table1'[argument2],'table1'[argument2],'table2'[argument2]))),"value1")
Return
IF(ISBLANK(value3),IF(NOT(ISBLANK(LOOKUPVALUE('table1'[argument1],'table1'[argument1],'table2'[argument1]))),"value2"),value3)

power bi power bi

If I don’t care about problem and just want to know about incident, use this formula:

IF(ISBLANK(LOOKUPVALUE('table1'[argument2],'table1'[argument2],'table2'[argument2])),"value2")

power bi

And for duplicates, just add the NOT function:

IF(NOT(ISBLANK(LOOKUPVALUE('table1'[argument2],'table1'[argument2],'table2'[argument2]))),"value1")

power bi
power bi power bi

Without relationship

If I just want to know only the problem or the incident, it is more simple. Both use the same formula:

IF(ISBLANK(LOOKUPVALUE('table1'[argument],'table1'[argument],'table2'[argument])),"value")

power bi power bi
power bi power bi

For duplicate, just add the NOT function:

IF(NOT(ISBLANK(LOOKUPVALUE('table1'[argument],'table1'[argument],'table2'[argument]))),"value")

power bi power bi
power bi power bi

Interesting Topics