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
mibu
Microsoft Employee
Microsoft Employee

Switch and else if logic question

Hey Everybody,

I am trying to add a custom column using the custom column formula as follows:

SWITCH (
    TRUE (),
    [FF]="D" and [PB]="A", "First",
    [FF]="De" and [PB]="A", "Second"
)

Power BI is telling me the name SWITCH wasn't recognized.

I have posted the .pbix file here

Pls advise formula to check multiple conditions in numerous columns and return distinct values.

 

I am also very open to a derivation on the following "IF" formula:

(if

([FF]= "D"

and

[PB]= "A")
then"First"
else"Not First")

BUT, that allows me to tag the "this and that" conditions, seperated by multiple "or" as I go down the stack of all the conditions I have to check for.  the "else" line of code above is what is throwing me.

 

Thanks so much!!!

mibu

 

1 ACCEPTED SOLUTION
mussaenda
Super User
Super User

Hi @mibu ,

 

Custom = 
    SWITCH (
    TRUE (),
    [FF]="D" && [PB]="A", "First",
    [FF]="De" && [PB]="A", "Second"
)

I tried your switch and it worked on your pbix.

 

2019_09_07_09_25_34_190612Dev_Read_Only_Power_BI_Desktop.png

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=IF(AND([FF]="D",[PB]="A"),"First",IF(AND([FF]="De",[PB]="A"),"Second",BLANK())

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mussaenda
Super User
Super User

Hi @mibu ,

 

Custom = 
    SWITCH (
    TRUE (),
    [FF]="D" && [PB]="A", "First",
    [FF]="De" && [PB]="A", "Second"
)

I tried your switch and it worked on your pbix.

 

2019_09_07_09_25_34_190612Dev_Read_Only_Power_BI_Desktop.png

mibu
Microsoft Employee
Microsoft Employee

Thanks so much @mussaenda!  It did work!  I just needed to create a Meausure, not add a column.  Switch is not a custom column formula.  Thanks for the assist...  I apprecite it!!  Best, mibu

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.