Forum Discussion
IF statement for banding numbers
- Anonymous8 years ago
Hi Anonymous,
Try:
if [NumberOfUsers] <250 then "SME" else if [NumberOfUsers] >=250 and [NumberOfUsers]<1000 then "Corporate" else if [NumberOfUsers] >=1000 and [NumberOfUsers]<5000 then "Enterprise" else if [NumberOfUsers] >=5000 then "Global" else "null"
Br,
T
- Anonymous8 years ago
Anonymous
Some clarification:
In Query Editor you can use my previous code and in DAX you can use Thejeswar code.
Br,
T
Hi Anonymous,
Use the below code
IF([NumberOfUsers] < 250, "SME", IF([NumberOfUsers] >= 250 && [NumberOfUsers] <= 1000, "Corporate",IF([NumberOfUsers] > 1000 && [NumberOfUsers] <= 5000, "Enterprise","Global")))
- Anonymous8 years agoNot applicable
got Token RightParen expected error on both of your solutions whats the reaosn for this? thank you
- Thejeswar8 years ago
Super User
Anonymous wrote:got Token RightParen expected error on both of your solutions whats the reaosn for this? thank you
This is likely because you are having an additional paranthesis (which is not expected) or missed a paranthesis in either side of your code.
Check if you have properly closed all your IFs
- vanessafvg8 years ago
Community Champion
Thejeswar this is why the switch statement is recommended in these scenarios, simplifies the very difficult to read long if statements