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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.