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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ismael92
Regular Visitor

Compare different tables

Good afternoon,

 

I am trying to compare two different tables with several columns:

 

Table1 with 20 columns

Table2 with 20 columns

 

Both tables have a column with the same identificator.

 

I have tried to use the below data structure:

 

Match =
var _table1 = SELECTEDVALUE('Table1'[Status1])
var _table2 = SELECTEDVALUE('Table2'[Status2])
return
IF(_table1=_table2, "Match", "Error")

 

It always retorn "Match" as comparation value,

 

Someone knows why this is not working properly?

 

Thanks in advance!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi  @ismael92 ,

I created some data:

Table1:

vyangliumsft_0-1679041597361.png

Table2:

vyangliumsft_1-1679041526955.png

 

 

Here are the steps you can follow:

1. Create measure.

 

Flag =
var _1=
SUMMARIZE(
    'Table1','Table1'[ID],'Table1'[status],
    "Table2match",MAXX(
        FILTER(ALL(Table2),'Table2'[ID]=EARLIER('Table1'[ID])),[status]))
var _2=
ADDCOLUMNS(
    _1,"Flag",
    IF(
        [status]=[Table2match],"Match","Error"))
return
MAXX(
    FILTER(
        ALL('True'),
        'True'[ID]=MAX('Table2'[ID])),'True'[Flag])

 

2. Result:

vyangliumsft_2-1679041526957.png

 

Best Regards,

Liu Yang

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

aditya0125
Resolver I
Resolver I

Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")

View solution in original post

3 REPLIES 3
aditya0125
Resolver I
Resolver I

Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")

Anonymous
Not applicable

Hi  @ismael92 ,

I created some data:

Table1:

vyangliumsft_0-1679041597361.png

Table2:

vyangliumsft_1-1679041526955.png

 

 

Here are the steps you can follow:

1. Create measure.

 

Flag =
var _1=
SUMMARIZE(
    'Table1','Table1'[ID],'Table1'[status],
    "Table2match",MAXX(
        FILTER(ALL(Table2),'Table2'[ID]=EARLIER('Table1'[ID])),[status]))
var _2=
ADDCOLUMNS(
    _1,"Flag",
    IF(
        [status]=[Table2match],"Match","Error"))
return
MAXX(
    FILTER(
        ALL('True'),
        'True'[ID]=MAX('Table2'[ID])),'True'[Flag])

 

2. Result:

vyangliumsft_2-1679041526957.png

 

Best Regards,

Liu Yang

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

tamerj1
Super User
Super User

Hi @ismael92 
How does your visual look like? Any other table(s) involved? Match is a measure, right?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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