Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Making new column based on whether value from another column in same table is in a different table

Hi,

 

I have two tables, A and B.

 

I want to make a new column in table A, such that if a value in another column in table A is in table B, then we set the value to 1, else we set it to 0.


Example:

TableA

Another column
1
2
3
4
5

 

TableB

B column
1
3

 

Resulting table 

Another columnNew column
11
20
31
40
50

 

I have googled high and low and tried this:

New Column = IF(
CALCULATE(COUNTROWS(Table2), FILTER(Table2, Table2[Value]=Table1[Value])) > 0,
1,0)

But this sets everything to 1 in the new column.

 

Any help would be really appreciated.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Anonymous Please try below calculated column in tableA

    Column = IF(TableA[Another column] IN VALUES(TableB[Column]),1,0)

    If it helps accept solution 

2 Replies