### RE: How do I create a filter in a saved search to only show if the margin percentage is 55% or less in PL SQL?

CASE WHEN (({price} – (CASE WHEN {cost} = {custitem_fcl_cost} THEN {cost} WHEN {custitem_fcl_cost} > {cost} THEN {custitem_fcl_cost} WHEN {cost} > {custitem_fcl_cost} THEN {cost} ELSE {custitem_fcl_cost} END)) / {price}) <=.55 THEN 1 ELSE 0 END

Basically it’s calculating margin percentage in the first part of the code. I don’t know how to create a max formula, so I just used a case when to find the max of the fcl cost or the regular cost of the item.

What is the right code to make this criteria work? I appreciate all your help!

Looks right. Then add a criteria for that formula being 1 or 0