Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous Please try below calculated column in tableA

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

If it helps accept solution 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

You can get based on lookup values or By filter function

 

New Column in A = maxx(filter(TableB,Table[Another Column]= TableB[B column]),[B column])

New Column = If(isblank([New Column in A]),0,1)

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Anonymous
Not applicable

@Anonymous Please try below calculated column in tableA

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

If it helps accept solution 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.