Forum Discussion

arelf27's avatar
arelf27
Icon for Helper II rankHelper II
9 years ago
Solved

DAX Text Function - Change values of a text column (like a lookup table)

Hi. I have what seems like a simple scenario but I don't understand how to do this in DAX:    I have a column on a table that has values (To Do, Next, WIP, Closed, etc.) - these values are multiple...
  • Anonymous's avatar
    Anonymous
    9 years ago

    arelf27, it sounds like you need to talk to the people in charge of your data and ask for a sort order column to be created.

     

    Yes, a DAX calculated column could do this (there is a SWITCH() function that would work), but you confirmed that you can't create additional calculated columns.

     

    In short, a measure won't work.  You can't put a measure on a categorical axis for a visual, Power BI won't let you.  The only visual that accepts measures on the axes like that is a scatter plot.

     

    If you can create a calc column, try this:

     

    SortMeasure =
    SWITCH (
        SELECTEDVALUE ( Table[Column] ),
        "To Do", "1-To Do",
        "Next", "2-Next",
        "WIP", "3-WIP",
        "Closed", "4-Closed"
    )