Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hi guys,
Hope you can help. I am trying to use a switch statement to create categories labeled as "0-7 days" "8-30 days" and"30+ days".
However I keep recieving the following error code:
"DAX Comparison operations do not support comparing values of type true/false with values of type integer. Consider using the VALUE or FORMAT function to convert one of the values".
I have attached a screenshot of the DAX and error message below:
I have checked the 'Days' Data type and it is formatted as a number. Any idea where I am going wrong and how to fix it?
Thanks in advance!
DRJ.
Solved! Go to Solution.
Hi @DRJ1994 ,
Please try this:-
length of sickness =
SWITCH (
TRUE (),
'Sheet1 (2)'[Days] <= 7, "0-7 days",
'Sheet1 (2)'[Days] >= 8
&& 'Sheet1 (2)'[Days] <= 30, "8-30 days",
'Sheet1 (2)'[Days] > 30, "30+ days"
)
BR,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Hi @DRJ1994 ,
Please try this:-
length of sickness =
SWITCH (
TRUE (),
'Sheet1 (2)'[Days] <= 7, "0-7 days",
'Sheet1 (2)'[Days] >= 8
&& 'Sheet1 (2)'[Days] <= 30, "8-30 days",
'Sheet1 (2)'[Days] > 30, "30+ days"
)
BR,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Thank you so much! That helped and solved my issue!
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 27 | |
| 23 | |
| 18 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 54 | |
| 44 | |
| 42 | |
| 39 | |
| 36 |