Forum Discussion

acg's avatar
acg
Resolver I
3 years ago
Solved

Conditional statements across different tables

I have two tables looking at schemes and their activity levels. I need to create a new variable (Retail / Default) that takes different conditional scenarios across these two tables into account.   ...
  • acg's avatar
    3 years ago

    After some discussion in the team, this is the solution:

    Scheme type  = 
    VAR ActiveDefault = 'Question Library KSAR'[Active/Default]
    VAR RestrictedStatus = RELATED('Scheme'[Restricted Scheme Name])
    RETURN
    
    SWITCH(
        TRUE(),
        ActiveDefault = "Active" && RestrictedStatus = "Yes", "Restricted",
        ActiveDefault = "Active" && RestrictedStatus = "No", "Retail",
        ActiveDefault = "Default" && RestrictedStatus = "Yes", "Restricted",
        ActiveDefault = "Default" && RestrictedStatus = "No", "Default",
        "Retail"
    )