There are 2 ways that you can do something like that.
1. Simply add some code in your load script that looks at the values and decides if the Display Value should be the number itself, or it should be lumped into a category. Personally I always like to use the Load Script so that the CPU work needed is only ever done 1 time and any user, at any time can then refer to it in any chart that they create as self-service and charts display faster.
2. The altnernative is to simply use that kind of expression inside the chart for the dimension itself. Notice on the left chart I just used the DisplayValue field from the data while on the right side I used the expression seen in the label and that I changed the text for the group to ensure you realized it was not the DisplayValue from the load script.