Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
Solved! Go to Solution.
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
Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")
Create Calculate Column
Comp column = If(Related(Table1[Status]),=Table2[Status],"Match","Error")
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
Hi @ismael92
How does your visual look like? Any other table(s) involved? Match is a measure, right?
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |