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
Anonymous
Not applicable

Custom Column in Power Query IF ELSE

Is there such a formula in Power Query Custom Column for this:

 

if ([BUSINESS_UNIT]='ZZZ' and STARTSWITH([ORDER_TYPE],'Standard')) then 'True'

elseif ([BUSINESS_UNIT]='ZZZ' and STARTSWITH([ORDER_TYPE],'Project')) then 'True'
elseif ([BUSINESS_UNIT]='XX' and STARTSWITH([ORDER_TYPE],'Project')) then 'True'
elseif ([BUSINESS_UNIT]='ZZZ' and STARTSWITH([ORDER_TYPE],'Standard')) then 'True'
elseif ([BUSINESS_UNIT]='AAA' and NOT STARTSWITH(STR([ORDER_NUMBER]),'9')) then 'True'
elseif ([BUSINESS_UNIT]='AAA' and NOT STARTSWITH(STR([ORDER_NUMBER]),'7')) then 'True'

else 'False' END

 

 

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

@Anonymous , and using lower case:

not (...)

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Anonymous , Try like

 

if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Standard") then "True"

else if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Project") then "True"
else if [BUSINESS_UNIT]="XX" and Text.StartsWith([ORDER_TYPE],"Project") then "True"
else if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Standard") then "True"
else if [BUSINESS_UNIT]="AAA" and NOT Text.StartsWith(STR([ORDER_NUMBER]),"9") then "True"
else if [BUSINESS_UNIT]="AAA" and NOT Text.StartsWith(STR([ORDER_NUMBER]),"7") then "True"

else "False"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak hi sir,

 

formula not working

 

Laedays_0-1635148559872.png

 

@Anonymous , Sorry, Number.ToText in place of STR

 

if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Standard") then "True"

else if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Project") then "True"
else if [BUSINESS_UNIT]="XX" and Text.StartsWith([ORDER_TYPE],"Project") then "True"
else if [BUSINESS_UNIT]="ZZZ" and Text.StartsWith([ORDER_TYPE],"Standard") then "True"
else if [BUSINESS_UNIT]="AAA" and NOT Text.StartsWith(Number.ToText([ORDER_NUMBER]),"9") then "True"
else if [BUSINESS_UNIT]="AAA" and NOT Text.StartsWith(Number.ToText([ORDER_NUMBER]),"7") then "True"

else "False"

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak the NOT sign is causing the error. IS there an alternative for NOT?

ERD
Community Champion
Community Champion

@Anonymous , try to use brackets near not:

not (...)

If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

@ERD HI

 

Laedays_0-1635151761446.png

still not working

ERD
Community Champion
Community Champion

@Anonymous , and using lower case:

not (...)

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

@amitchandak hi sir,

 

Laedays_0-1635149485153.png

 

still showing issues for the new formula

Helpful resources

Announcements
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!

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.

Top Solution Authors