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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Help with correcting conditional column in Power Query

Hi

 

Can someone help me correct this:

 

= Table.AddColumn(#"Changed Type1", "Charge", if [Freight_Kind] = "ABC" and [Category] = "BBC" or "BBD" then 10.5 else 0)

 

error Im getting is:

Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?

 

Thanks so much!

 

1 ACCEPTED SOLUTION

Then you should provide a sample...

or...

 

= Table.AddColumn(#"Changed Type1", "Charge", each if [Freight_Kind]="ABC" and ([Category]="BBC"or [Category]="BBD") then 10.5 else 0)

 

And you can play with parenthesis...

View solution in original post

4 REPLIES 4
Jakinta
Solution Sage
Solution Sage

= Table.AddColumn(#"Changed Type1", "Charge", if [Freight_Kind] = "ABC" and [Category] = "BBC" or [Category]="BBD" then 10.5 else 0)

Anonymous
Not applicable

Thanks for your quick response but Im still getting the same error?

 

Then you should provide a sample...

or...

 

= Table.AddColumn(#"Changed Type1", "Charge", each if [Freight_Kind]="ABC" and ([Category]="BBC"or [Category]="BBD") then 10.5 else 0)

 

And you can play with parenthesis...

Anonymous
Not applicable

Thats done it, thanks so much!

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.

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.