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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Star_Dust
New Member

If (or) to compare 3 pairs of columes

Hi All, 

 

I want to compare below 3 pairs of columes, if any of the planned columes > actual columes, I need it return "Y" to identify partial delivery. 

 

Partial Delivery? = if(OR(FactShipments[PlannedCube]>FactShipments[Cube (m3)],FactShipments[PlannedQty]>FactShipments[Quantity]),FactShipments[PlannedWeight]>FactShipments[Weight (tonne)],"Y","N")

 

I know I can only include two arguments, so I took off one of them and used 

 

Partial Delivery? = if(OR(FactShipments[PlannedCube]>FactShipments[Cube (m3)],FactShipments[PlannedQty]>FactShipments[Quantity]),"Y","N")

 

But still, the results did not work correctly, all columes returned "N", can anyone help please? thanks

 

 

BeckyS

 

1 ACCEPTED SOLUTION
dedelman_clng
Community Champion
Community Champion

OR only is able to compare two values.  To compare 3, you need to embed another OR statement:

 

OR( [cond1], OR( [cond2], [cond3] ) )

 

 

Alternatively you can use || (pipe, pipe) as shorthand for OR within a logical expression.  These you can string together as much as you would need.

 

[cond1] || [cond2] || [cond3] || [cond4] || etc

 

 

Finally, make sure that your data is numeric (not just looks numeric but is treated as such in the model) and that you have the < or > pointing the right direction.

 

Hope this helps

David

View solution in original post

1 REPLY 1
dedelman_clng
Community Champion
Community Champion

OR only is able to compare two values.  To compare 3, you need to embed another OR statement:

 

OR( [cond1], OR( [cond2], [cond3] ) )

 

 

Alternatively you can use || (pipe, pipe) as shorthand for OR within a logical expression.  These you can string together as much as you would need.

 

[cond1] || [cond2] || [cond3] || [cond4] || etc

 

 

Finally, make sure that your data is numeric (not just looks numeric but is treated as such in the model) and that you have the < or > pointing the right direction.

 

Hope this helps

David

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.