Forum Discussion
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!
- Anonymous3 years ago
Hi ismael92 ,
I created some data:
Table1:
Table2:
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:
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
- Anonymous3 years ago
Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")
3 Replies
- AnonymousNot applicable
Hi ismael92 ,
I created some data:
Table1:
Table2:
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:
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
- AnonymousNot applicable
Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")