Forum Discussion
DAX expression to look values between 2 tables
- 1 year ago
Hi rsrajkumar ,
This can be achieved through a calculated column in Table 1. Here's a DAX expression that will return 1 if the case number exists in Table2, and 0 otherwise:Status = IF( CONTAINS(Table2, Table2[Case Number], Table1[Case Number]), 1, 0 )If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,Samson
- 1 year ago
Hi rsrajkumar , would you be able to send the DAX expression you are leveraging for the calculated column?
Alternatively, you could use a lookup:Status = IF( NOT ISBLANK( LOOKUPVALUE(Table2[Case Number], Table2[Case Number], Table1[Case Number]) ), 1, 0 )If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,Samson
Hi rsrajkumar ,
This can be achieved through a calculated column in Table 1. Here's a DAX expression that will return 1 if the case number exists in Table2, and 0 otherwise:
Status =
IF(
CONTAINS(Table2, Table2[Case Number], Table1[Case Number]),
1,
0
)
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson
Hi SamsonTruong ,
Thank you for your response. When I tried your proposed solution, I get an error, "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value" . What could be the problem?
- SamsonTruong1 year ago
Super User
Hi rsrajkumar , would you be able to send the DAX expression you are leveraging for the calculated column?
Alternatively, you could use a lookup:Status = IF( NOT ISBLANK( LOOKUPVALUE(Table2[Case Number], Table2[Case Number], Table1[Case Number]) ), 1, 0 )If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,Samson
- rsrajkumar1 year ago
Helper I
Thanks a lot SamsonTruong
Both the solutions worked. The first one did not work initially due to a typo.