Forum Discussion
How to compare two column with the same name with the different table in power bi.
- 7 years ago
Hey arvindyadav
from my understanding the relationships of the model should look like this:
This will allow to create a report like this:
Please be aware that the columns Name and Output are used from the table New Table. The table "New Table" to filter both tables. I think it will a good idea to rename the column RPC accordingly to make it somewhat simpler to differentiate between both columns, eg. "RPC (...) Yesterday". Make sure that you use the "Name" column from the table "New Table".
Hopefully this is providing what you are looking for.
Regards,
Tom
Hey,
I created a new table "New Table" using this DAX statement:
New Table =
DISTINCT(
UNION(
VALUES(Table1[Name])
,VALUES('Table2'[Name])
)
)
Then I create a calculated column using this DAX statement:
Output =
var thisName = 'New Table'[Name]
var tExist = INTERSECT(VALUES('Table1'[Name]), VALUES('Table2'[Name]))
var tMoveOut = EXCEPT(VALUES('Table1'[Name]), VALUES('Table2'[Name]))
var tNew = EXCEPT(VALUES('Table2'[Name]), VALUES('Table1'[Name]))
return
SWITCH(
TRUE()
,thisName in tExist, "Exist"
,thisName in tMoveOut, "Move Out"
,thisName in tNew, "New"
,"this is odd"
)
After this the table New Table looks like this:
Hopefully this is what you are looking for.
Regards,
Tom
- arvindyadav7 years ago
Post Partisan
Hi TomMartens ,
Thank You Very Much!!
It works but when I adding Table1 or table 2 RPC value then it reflects the same the number for all Name. How to fix this problem.
Thanks,
Arvind
- v-lili6-msft7 years ago
Community Support
hi, arvindyadav
You just need to create the relationship between table1 and new table by Name column and create the relationship between table2 and new table by Name column too.
Best Regards,
Lin
- arvindyadav7 years ago
Post Partisan
Hi v-lili6-msft ,
How to create a relationship between the table.
I tried but nothing happens.
Thanks,
Arvind