Forum Discussion

drrai66's avatar
drrai66
Icon for Resolver I rankResolver I
8 years ago
Solved

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   ...
  • Anonymous's avatar
    Anonymous
    8 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)