Forum Discussion
__zhe
7 years agoFrequent Visitor
Mark Differences Between 2 Table
Hi There, I have 2 tables, Table 1 and Table 2 and i am trying to mark items that unique/not in each other table We can find and list with EXCEPT but how I want to just to mark it down...
- 7 years ago
In that case, you can select the relevant columns first from both tables using "SELECTCOLUMNS" function
Then apply the above procedure
i.e.
Calculated Table = VAR firstTable = SELECTCOLUMNS ( Table1, "ID", [ID], "Serial", [Serial], "Name", [Name] ) VAR SecondTable = SELECTCOLUMNS ( Table2, "ID", [ID], "Serial", [Serial], "Name", [Name] ) VAR Common = INTERSECT ( firstTable, SecondTable ) VAR NotCommon = EXCEPT ( DISTINCT ( UNION ( firstTable, SecondTable ) ), Common ) RETURN UNION ( ADDCOLUMNS ( Common, "Unique", "No" ), ADDCOLUMNS ( NotCommon, "Unique", "Yes" ) )
__zhe
7 years agoFrequent Visitor
Hi v-yulgu-msft table 1 & 2 have different structure, forgotten to mention in the example and also how to nood include null value
v-yulgu-msft
7 years agoMicrosoft Employee
Hi __zhe,
table 1 & 2 have different structure, forgotten to mention in the example and also how to nood include null value
As Zubair_Muhammad mentioned in previous reply, you can use SELECTCOLUMNS to deal with this problem.
Regards,
Yuliana Gu