Forum Discussion

e77948's avatar
e77948
Regular Visitor
4 years ago
Solved

How do I write an IF then formula

I have a table and I need to show the data depending upon one column, I am trying to write a measure that will show the number of work items if that colu
  • BA_Pete's avatar
    4 years ago

    Hi e77948 ,

     

    In Power Query, it's like this:

    if somethingIsTrue
    then doThis
    else if somethingElseIsTrue
    then doThisThingInstead
    else doThisThing

     

    In DAX, it's like this:

    IF(
        somethingIsTrue,
        doThis,
        doThisThingInstead
    )

     

    Pete

  • BA_Pete's avatar
    BA_Pete
    4 years ago

     

    Ah, ok, my bad. Text functions don't skip blanks.

    Try this one:

    if [Tags] = null then "Primary"
    else if Text.Contains([Tags], "Secondary") then "Secondary"
    else "Primary"

     

    Pete