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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ykankam
Helper I
Helper I

switch not working correctly

I am using SWITCH function to get 4 different values. The first 3 works as expect, but the last condition does not return the expected value which is "Terminated". What could I be doing wrong?  Values from the highlighted column should be "Terminated".

switch 2.pngswitch 3.png

1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@Ykankam ,

The SWITCH function works in sequence.  If it doesn't find Condition 1, it moves to the next.

My assumption here, without seeing all of the columns in your dataset, is that all of the conditions for "In Progress" are being met, so the SWITCH never reaches Condition 4 for "Terminated".

Try moving the "Terminated" Condition to be the 1st or 2nd and see if that resolves your issue.

Regards,

View solution in original post

3 REPLIES 3
tackytechtom
Super User
Super User

Hi @Ykankam ,

 

The BLANK() would kick in, if your column was null. In the screenshot, however, it appears that the value is an empty string.


What happens, if you try:

&& [Release_On_Time] = "" && [Complete_On Time] = ""

 

Does it work? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

@tackytechtom thanks for your input. Since SWICTH works in a sequencial order, i had to place the terminated condition first. Code now looks like as shown below

GoldenBatch =
SWITCH (
    TRUE (),
    [termstatus] = "Term", "Terminated",
    [thaw_onTime] = "Y"
        && [proA_onTime] = "Y"
        && [BDS_onTime] = "Y"
        && [harvest_onTime] = "Y"
        && [%RFT_RFT] = "Y"
        && [titer_inFull] = "Y"
        && [yield_inFull] = "Y"
        && [deviation_RFT] = "Y", "Golden Batch",
    [thaw_onTime] = "N"
        || [proA_onTime] = "N"
        || [BDS_onTime] = "N"
        || [harvest_onTime] = "N"
        || [%RFT_RFT] = "N"
        || [titer_inFull] = "N"
        || [yield_inFull] = "N"
        || [deviation_RFT] = "N", "Miss",
    [thaw_onTime] = BLANK ()
        || [proA_onTime] = BLANK ()
        || [BDS_onTime] = BLANK ()
        || [harvest_onTime] = BLANK ()
        || [%RFT_RFT] = BLANK ()
        || [titer_inFull] = BLANK ()
        || [yield_inFull] = BLANK ()
        || [deviation_RFT] = BLANK (), "In Progress"
)
rsbin
Super User
Super User

@Ykankam ,

The SWITCH function works in sequence.  If it doesn't find Condition 1, it moves to the next.

My assumption here, without seeing all of the columns in your dataset, is that all of the conditions for "In Progress" are being met, so the SWITCH never reaches Condition 4 for "Terminated".

Try moving the "Terminated" Condition to be the 1st or 2nd and see if that resolves your issue.

Regards,

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI 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.

Top Solution Authors
Top Kudoed Authors