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?

I’ve been been able to create three formulas in the Results subtab in a saved search to calculate the Max Cost, Margin, and Margin Percentage. (See screenshot). Now, I’m trying to filter my list in the Criteria tab to only show the items that have a margin of 55% or less. Here’s my code so far:

 

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!

jnilsson2810 Rookie Asked on February 21, 2020 in How To's.
Add Comment
1 Answers

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

Advanced Answered on February 25, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.