Forum Discussion
Return a new Column in Table 1 By Comparing a Column In 2 Tables
- Anonymous8 years ago
Try this:
Column = SWITCH ( TRUE (), AND ( Table1[ID] = RELATED ( Table2[ID] ), Table1[Eligibility] = "Eligible" ), "Yes", Table1[Eligibility] = "Eligible", "No", AND ( Table1[ID] = RELATED ( Table2[ID] ), Table1[Eligibility] = "N/A" ), "Yes", "N/A" )This pattern is the same as a nested IF statement:
SWITCH(TRUE(),
Condition1 being true, Result1,
Condition2 being true, Result2,
...,
Result if everything is false
)
Use AND() to join to logical statements.
Use RELATED() to get the value in the related tables column (roughly similar to a VLOOKUP in Excel)
Try this:
Column =
SWITCH (
TRUE (),
AND ( Table1[ID] = RELATED ( Table2[ID] ), Table1[Eligibility] = "Eligible" ), "Yes",
Table1[Eligibility] = "Eligible", "No",
AND ( Table1[ID] = RELATED ( Table2[ID] ), Table1[Eligibility] = "N/A" ), "Yes",
"N/A"
)This pattern is the same as a nested IF statement:
SWITCH(TRUE(),
Condition1 being true, Result1,
Condition2 being true, Result2,
...,
Result if everything is false
)
Use AND() to join to logical statements.
Use RELATED() to get the value in the related tables column (roughly similar to a VLOOKUP in Excel)
Hi Chris,
This Would Work, I know, but the thing is that those numbers are repeating in my Table 2, so I have One to Many Relationship between Table 1 and Table 2 In My data, So When I write your Calc, I don't get the Name of Table 2 . Any Work Around for this?
Thanks
Deepak
- drrai668 years ago
Resolver I
Hi Chris,
Using the Logic in here, I am able to Solve.
I first Created a Column in Table 1 and Then Used your Logic to Solve it.
Thanks
and Regards
Deepak