The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |