Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.. I need to write a measure to convert these as such: (1-To Do, 2-Next, 3-WIP, 4-Closed, etc.) --I would have loved to do that by creating a lookup table or even just add and transform a column in Edit Queries, however I have a live connection to Visual Studio Team Services and thus most features are disabled, including Modeling, New Columns, Edit Queries, etc.. All I am able to do is Add a Measure (thus I'm trying to figure out how to do this in DAX..) ---Essentially since I put this column on my X-axis, my sort order is not correct, hence I'm trying to rename values to get the correct sort order on the visual...
If I try to do If statement, etc. I keep getting multiple values were supplied to a function that was expecting a single value...
In SQL this would be an equivalent of a simple Case statement, with a group by etc.
Solved! Go to Solution.
@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" )
@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" )
I see. Thaks for replying. I'm working with data from Visual Studio Team Services (VSTS) - built a solution in PowerBI Services by connecting to their app/content pack, so it's quite limiting as to what can be done.. I thought I'd try connecting live to it in PowerBI Desktop but with that the only additional thing I can do is create measures.. Everything else is still grayed out.. (basically I don't have access to this online Content Pack database...)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
80 | |
76 | |
60 | |
36 | |
33 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |