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! Learn more

Reply
Anonymous
Not applicable

Error with code

Dear all,

 

I have writted below code to conditional custom column

 

if [Plnt]="776" and [DP]="0776" and [P] = "E" then "Manufactured"
else "other"

 

But column shows all values as "Other". But no syntax error found. 

@d_gosbell , Can you check this?Untitled.jpg

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this work?

=if [Plnt]=776 and [DP]="0776" and [P] = "E" then "Manufactured" else "other"

Hope this helps.


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

View solution in original post

3 REPLIES 3
saraMissBI
Resolver I
Resolver I

Hi @Anonymous 

 

I think there must be something in the evaluation of the if statement. Try to check the data type of your columns Plnt, DP, and P and update the formula accordingly.

 

I hope that could help

Regards  

Ashish_Mathur
Super User
Super User

Hi,

Does this work?

=if [Plnt]=776 and [DP]="0776" and [P] = "E" then "Manufactured" else "other"

Hope this helps.


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

Specifically note the difference between the code for [DP] that @Ashish_Mathur  posted compared to the code in your screenshot (not the code you pasted into this post which is different from the screen shot). [DP] is a text column so you need to compare it to "0776" if you type 0776 without the quotes this will get interpreted as the number 776 as the leading 0 is not significant in numeric values. You could test this yourself by temporarily creating 3 calc columns with each of the 3 conditions to see which one was not working as expected.

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