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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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.

Stand with Ukraine!


Here is an official way you can support Ukraine financially:
Come Back Alive foundation: https://savelife.in.ua/en/

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.

Stand with Ukraine!


Here is an official way you can support Ukraine financially:
Come Back Alive foundation: https://savelife.in.ua/en/

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.

Stand with Ukraine!


Here is an official way you can support Ukraine financially:
Come Back Alive foundation: https://savelife.in.ua/en/

Thank you!

Anonymous
Not applicable

@amitchandak hi sir,

 

Laedays_0-1635149485153.png

 

still showing issues for the new formula

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.