Forum Discussion
Custom text output based on number values
- 3 years ago
You can use the SWITCH function in DAX to create the categories based on the length of service of employees. Here's an example of how to do it:
Service Category = SWITCH( TRUE(), [Length of Service] < 0.25, "0-3 months", [Length of Service] < 1, "3-12 months", [Length of Service] < 2, "1-2 years", [Length of Service] < 5, "2-5 years", [Length of Service] >= 5, "5+ years" )In the above example, replace [Length of Service] with the name of the column that contains the length of service of employees in years. The SWITCH function evaluates each condition in the order they are listed and returns the corresponding category text if the condition is true. If none of the conditions are true, it returns blank. You can adjust the conditions and category texts to fit your specific intervals.
You can use the SWITCH function in DAX to create the categories based on the length of service of employees. Here's an example of how to do it:
In the above example, replace [Length of Service] with the name of the column that contains the length of service of employees in years. The SWITCH function evaluates each condition in the order they are listed and returns the corresponding category text if the condition is true. If none of the conditions are true, it returns blank. You can adjust the conditions and category texts to fit your specific intervals.
- KGBOR3 years agoHelper I
Thank you very much for the detailed answer! Just for my understanding: what does the TRUE operator do in this formula? The rest I understand now but that one is not entirely clear right now. Thank you again!