Forum Discussion
drrai66
8 years agoResolver I
Return a new Column in Table 1 By Comparing a Column In 2 Tables
Hi Experts, I am on learning curve for Power BI but a heavy user of Tableau. I need your help in this situtaion: I have 2 Tables as Follows and both of These Tables are Related on ID Table1 ...
- 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)
Anonymous
8 years agoNot applicable
Hi drrai66,
In the query editor, merge these tables, in the first table or as a new table.
Then create a new custom column using this formula with the logic that you describe:
if (([ID] = [Table2.ID]) and ([Eligibility] = "Eligible"))then "Yes"
else
if [Eligibility]="Eligible" then
"No"
else
if [Eligibility] = "N/A" and [ID]=[Table2.ID] then
"Yes"
else
"N/A"Remove the Table2.ID column and you will get the table you want.
Regards
drrai66
8 years agoResolver I
Thanks for Your Time Felipe. Thing is my Original Dat aset is not That Simple and Merge is not an Option, but your Calc is going to help me at some other place in my Data.
Regards
Deepak