Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am trying to group staff's tenure into 5 main categories : Less than 1 year, Between 1 and 3 years, Between 3 and 5 years and Between 5 and 10 years. To do this, I created a new column and came up with the following DAX formula
Independent of the other replies - check out the SWITCH(TRUE()) syntax sugar that makes your nested IF statements look a bit better
SWITCH(TRUE(),Stafflist[Tenure]>10,"More than 10 yrs",Stafflist[Tenure]>5,"Between 5 and 10 yrs",Stafflist[Tenure]>3,"Between 3 and 5 yrs",Stafflist[Tenure]>1,"Between 1 and 3 yrs","Less than 1 yr")
Hi @pauline_teo ,
Please check format of Stafflist [Tenure].
Change it from text to Whole Number.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Got it. Thanks!
@pauline_teo
The message means what it says. You're comparing text value with numeric value. And because all comparisions in your DAX are similar Stafflist[Tenure]>{numeric value}, then the only place in a comparison where for a text value is Stafflist[Tenure] field. Verify the Stafflist[Tenure] column and make sure you changed it's data type to Whole number.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |