Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I'm trying to create a column which classifies another column of growth rates into text, specifically:
Low (<20%), Medium (20-50%), High (50-100%) and Very High (>100%)
To do this I'm using the switch function:
Growth Category =
SWITCH( TRUE(),
('Priority List'[Observed passenger growth in last 10 years]) < .2 , "Low",
('Priority List'[Observed passenger growth in last 10 years]) > .2 & ('Priority List'[Observed passenger growth in last 10 years]) < .5, "Medium",
('Priority List'[Observed passenger growth in last 10 years]) > .5 & ('Priority List'[Observed passenger growth in last 10 years]) < 1, "High",
('Priority List'[Observed passenger growth in last 10 years]) > 1, "Very High")
But Power Bi keeps returning this error - DAX comparison operations do not support comparing values of type Number with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
Any ideas to fix this?
TRUE(),
'Priority List'[Observed passenger growth in last 10 years] < .2 , "Low",
'Priority List'[Observed passenger growth in last 10 years] < .5, "Medium",
'Priority List'[Observed passenger growth in last 10 years] < 1, "High",
"Very High"
you nested if in scenarios like this.
Growth Category =
IF('Priority List'[Observed passenger growth in last 10 years]) < .2 , "Low",
IF('Priority List'[Observed passenger growth in last 10 years]) < .5, "Medium",
IF('Priority List'[Observed passenger growth in last 10 years]) < 1, "High", "Very High")))
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.