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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors