0
votes

I have 2 tables in PowerBI where I would like to compare value when it matches one column value.

Table 1

Number  Code
111      aa
222      bb
333      cc

Table 2

Number  Code
111      aa
222      bc
222      bb
333      ff
666      gg

Now what I would like to do is to compare the code when the Number Matches. Means the Output should look like in a comparison column-

Number  Code  Result
111      aa    Matches
222      bc    Not Matches
222      bb    Matches
333      ff    Not Matches
666      gg    Unknown

Do anyone knows any solution to solve this challenge!

2

2 Answers

0
votes

The simplest way is to create a relationship between the tables and create a calculated column to one of them. The calculated column DAX should be something like:

Result = IF('Table 1'[Code] == 'Table 2'[Code], "Matches", "Not Matches")

Other way would be to create a calculated table based on both tables with DAX Summarize-function, create relationships to this calculated table and create a similar calculated column or a measure as above.

More information about relationships in Power Bi here and here

0
votes

This might work: "Result = IF('Table 1'[Code] = 'Table 2'[Code]; "Matches"; "Not Matches")"