Skip to main content
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
paguy215
Helper III
Helper III

SWITCH with if conditions?

I have a DAX code in which i'm creating % buckets based on ranges of values...the below is creating a bucket based on where each agent falls according to amount of sales:

 

Value =
SWITCH (
TRUE (),
[TMRA2] >= 0
&& [TMRA2] < 16000, .70,
[TMRA2] >= 16000
&& [TMRA2] < 36000, .75,
[TMRA2]>= 36000
&& [TMRA2] < 66000, .80,
[TMRA2]>= 66000
&& [TMRA2] <91000, .85,
.90
)
 
This works, however one agent is 'grandfathered' and has a default percentage of 90% regardless of sales.   I would love to keep them all in one visual instead of creating a seperate bucket that just equals 90%.
 
Is there any way to do this?
3 REPLIES 3
AlexisOlson
Super User
Super User

Put a check for if the agent is grandfathered before any of the other logic.

SWITCH (
    TRUE (),
    [IsGrandfatheredAgent], .90,
    [TMRA2] >= 0     && [TMRA2] < 16000, .70,
    [TMRA2] >= 16000 && [TMRA2] < 36000, .75,
    [TMRA2] >= 36000 && [TMRA2] < 66000, .80,
    [TMRA2] >= 66000 && [TMRA2] < 91000, .85,
    .90
)

Thanks, I can't get that to work though.  I created a column to indicate whether or not agent was grandfathered, but i'm not able to add that to the SWITCH formula

If you're writing a measure rather than a calculated column, then you can't just use the column, you need some sort of aggregator. For example, assuming you have a 0/1 column in your agent dimension table,

SWITCH (
    TRUE (),
    SELECTEDVALUE ( dimAgent[IsGrandfathered] ) = 1, .90,
    [TMRA2] >= 0     && [TMRA2] < 16000, .70,
    [TMRA2] >= 16000 && [TMRA2] < 36000, .75,
    [TMRA2] >= 36000 && [TMRA2] < 66000, .80,
    [TMRA2] >= 66000 && [TMRA2] < 91000, .85,
    .90
)

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)