Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Need help with condition for null

Hello friends, i have a column where are birth years of users, but there are also null values. I need to make a condition where i need to find if user is "older 50 years", "younder 50 years" or "cann...
  • az38's avatar
    6 years ago

    Anonymous 

    hi

    try

    Older or younger 50 years =
    Switch ( True();
    2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
    ISBLANK('Data 2015, 2016'[birth year]); "Cant calculate";
    2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")

    or, if your field return null as a text:

    Older or younger 50 years =
    Switch ( True();
    2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
    'Data 2015, 2016'[birth year] = "null"; "Cant calculate";
    2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")
  • nandukrishnavs's avatar
    6 years ago

    Anonymous 
    Try this

    Older or younger 50 years = 
    var age= 2020- 'Data 2015'[birth year]
    var result = IF(ISBLANK('Data 2015'[birth year]),"Cant calculate",IF(age>50,"Greater","less"))
    return result