Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
The formula below is not working for some reason.. Can somebody help correct me?
SWITCH (
TRUE,
[Days] < 30, "<30 Days",
[Days] >= 30 && [Days] <= 69, "30-69 Days",
[Days] >= 70 && [Days] <= 100, "70-100 Days",
[Days] >= 101 && [Days] <= 140, "101-140 Days",
[Days] >= 141 && [Days] <= 180, "141-180 Days",">180 Days")
The logic is this:
IF [Days] <30 THEN "<30 Days"
ELSEIF [Days] >= 30 AND [Days] <= 69 THEN "30-69 Days"
ELSEIF [Days] >= 70 AND [Days] <= 100 THEN "70-100 Days"
ELSEIF [Days] >= 101 AND [Days] <= 140 THEN "101-140 Days"
ELSEIF [Days] >= 141 AND [Days] <= 180 THEN "141-180 Days"
ELSE ">180 Days" END
Thank you!
Solved! Go to Solution.
@Anonymous
maybe try this
SWITCH (
TRUE(),
[Days] < 30, "<30 Days",
[Days] <= 69, "30-69 Days",
[Days] <= 100, "70-100 Days",
[Days] <= 140, "101-140 Days",
[Days] <= 180, "141-180 Days",">180 Days")
Proud to be a Super User!
@Anonymous What exact error is it showing?
this is the error, unexpected expression for those in red line
Hi,
I don't see anything wrong with that construction. For which values is it not working? Please give some examples.
Regards
You haven't tried to enter that as a measure, as opposed to a calculated column, by any chance?
Regards
@Anonymous
maybe try this
SWITCH (
TRUE(),
[Days] < 30, "<30 Days",
[Days] <= 69, "30-69 Days",
[Days] <= 100, "70-100 Days",
[Days] <= 140, "101-140 Days",
[Days] <= 180, "141-180 Days",">180 Days")
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 31 | |
| 28 | |
| 24 |