Forum Discussion
New Column: If other table contains value
Hi guys!
Hopefully you can help with creating a measure 🙂
I want to add a New column in the Data tab in Table1 (could also maybe be the Power Query?). I have two data tables:
Table1 has 1 ID per row:
Table2 has multiple rows per ID with different data in the f.e. 'Weighting' or 'Zero Section' column:
What do I want? In Table1 I want to have an New column that has a Yes/No data. For example for row with ID 32:
If ID 32 has in Table2 in the column 'Zero Section' only "no"'s, then put "no" in the New column in Table1. If ID 32 has in Table2 in the column 'Zero Section' a "yes" then put "yes" in the New column in Table1.
Any ideas?
Greetings Kimberly
Try this calculated column in Table1:
New Column = VAR vID = Table1[ID] VAR vTable = FILTER ( Table2, Table2[ID] = vID && Table2[Zero Section] = "yes" ) VAR vResult = IF ( ISEMPTY ( vTable ), "no", "yes" ) RETURN vResult
2 Replies
- DataInsights
Super User
Try this calculated column in Table1:
New Column = VAR vID = Table1[ID] VAR vTable = FILTER ( Table2, Table2[ID] = vID && Table2[Zero Section] = "yes" ) VAR vResult = IF ( ISEMPTY ( vTable ), "no", "yes" ) RETURN vResult- KimberlyHMFrequent Visitor
Yes this worked perfectly, thank you!