This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Hi,
I am trying to create buckets of customers based on % change YTD vs PYTD revenue. I only want to group negative values. I am getting strange results where all my negative values in my table are showing “< -30%”. Does anyone know what error I am making?
TEST Bucket =
VAR testCondition = DIVIDE([YTD vs PYTD Revenue],[PYTD Revenue],0)
RETURN
SWITCH(
TRUE(),
testCondition<= 0 && testCondition> -30, "< -30%",
testCondition<= -30 && testCondition> -40,"-30% to -39%",
testCondition<= -40 && testCondition> -50,"-40% to -49%",
testCondition<= -50 && testCondition> -60,"-50% to -59%",
testCondition<= -60 && testCondition> -70,"-60% to -69%",
testCondition<= -70 && testCondition> -80,"-70% to -79%",
testCondition<= -80 && testCondition> -90,"-80% to -89%",
testCondition<= -90 && testCondition> -100,"-90% to -100%"
)
https://drive.google.com/file/d/1IjPb5BjE8eiqIqTHInvOYzuWh8QDtZ5S/view?usp=sharing
Solved! Go to Solution.
@nbs33 can you try this
TEST Bucket =
VAR testCondition = DIVIDE([YTD vs PYTD Revenue],[PYTD Revenue],0)
RETURN
SWITCH(
TRUE(),
testCondition> -100&&testCondition<= -90,"-90% to -100%",
testCondition> -90&&testCondition<= -80,"-80% to -89%",
testCondition> -70&&testCondition<= -60,"-70% to -79%"
--------------------------------------------------------
--------------------------------------------------------
testCondition> -30&&testCondition<= 0,"0 to -30%")
@nbs33 did you try this yet?
@nbs33 can you try this
TEST Bucket =
VAR testCondition = DIVIDE([YTD vs PYTD Revenue],[PYTD Revenue],0)
RETURN
SWITCH(
TRUE(),
testCondition> -100&&testCondition<= -90,"-90% to -100%",
testCondition> -90&&testCondition<= -80,"-80% to -89%",
testCondition> -70&&testCondition<= -60,"-70% to -79%"
--------------------------------------------------------
--------------------------------------------------------
testCondition> -30&&testCondition<= 0,"0 to -30%")
@smpa01 this worked! The just had to change the values to decimal form and it worked perfectly.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 5 | |
| 3 | |
| 1 |
| User | Count |
|---|---|
| 15 | |
| 7 | |
| 7 | |
| 6 | |
| 5 |