Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Creating a new column with multiple IF-statements from different tables

Hi everyone   I am trying to create a new column in table 1 in which it should say "Yes" if several conditions from the 3 separate tables are met.   All three tables are related by the ID-variabl...
  • PaulOlding's avatar
    4 years ago

    Hi Anonymous 

    Here's some DAX for your new column

    New column = 
    IF(
        Table1[Status] <> "Active", "No",
        VAR _RedOrBlue = CALCULATE(COUNTROWS(Table2), Table2[Colour] IN {"Red", "Blue"})
        VAR _EndAfterToday = CALCULATE(COUNTROWS(Table3), Table3[End date] > TODAY())
        VAR _Result = IF(_RedOrBlue >= 1 && _EndAfterToday >= 1, "Yes", "No")
        RETURN
            _Result
    )

    Assuming your model looks something like this