Forum Discussion
damjanv123
6 years agoNew Member
Case Statement (Tableau) to DAX
I want to assign a numerical value to a categorical value (represented by text) and need to find the best way to do this in DAX/PowerBI. I've tried a few Switch commands but am getting errored out b...
mahoneypat
Microsoft Employee
6 years agoIf you are making a calculated column, an easier way may be with a groups column. See this link.
https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-grouping-and-binning
If not, see this link to use SWITCH(TRUE(), ... which can also be used to get your desired results.
https://powerpivotpro.com/2015/03/the-diabolical-genius-of-switch-true/
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat