Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

column condition if else

Hello 

Column will always three values , " Y", "N","Null" .

I did sample calculated column in dax  if colum1 = 'Y', 'N', but how do i look for "null" value also if  two values (y&N) not found.

 

Thanks 

Refint

  • Hi Anonymous 

    it depends on what exactly null do you have.

    if you have "null" as text compare it with null in quotas:

    IF([Column1] = "Null", 1, 0)

    if you have null as blank field try ISBLANK()

    IF(ISBLANK([Column1]), 1, 0)

    or BLANK()

    IF([Column1] = BLANK(), 1, 0)

    so, your full statement if you have both nulls in data:

    SWITCH(TRUE(),
    [Column1] = "Y", "Y value",
    [Column1] = "N", "N value",
    [Column1] = "Null", "Null as text value",
    [Column1] = BLANK(), "Null as blank value",
    "any other value"
    )
    

     

4 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    it depends on what exactly null do you have.

    if you have "null" as text compare it with null in quotas:

    IF([Column1] = "Null", 1, 0)

    if you have null as blank field try ISBLANK()

    IF(ISBLANK([Column1]), 1, 0)

    or BLANK()

    IF([Column1] = BLANK(), 1, 0)

    so, your full statement if you have both nulls in data:

    SWITCH(TRUE(),
    [Column1] = "Y", "Y value",
    [Column1] = "N", "N value",
    [Column1] = "Null", "Null as text value",
    [Column1] = BLANK(), "Null as blank value",
    "any other value"
    )
    

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    To find the null value 

     

    ISBLANK('table'[column])     //Returns a Boolean value of TRUE if the value is blank; otherwise FALSE.

     

    Did I resolve your issue? Mark my post as a solution!

     

    Appreciate your Kudos, Press the thumbs up button!!

     

    Regards,
    Pranit