NetSuite – Formula in a Saved Search to calculate a percentage of approved Sales Orders

formulanetsuite

I would like to create a Saved Search in NetSuite that returns the percentage of Sales Orders that have been approved in a specific period, however I haven’t been able so far to find out a formula that returns this information.

I was able to add a result field with the count of Sales Orders and a formula field that returns the count of approved Sales Orders, (ie. formula (SUM):
CASE WHEN {status} != 'Pending Approval' THEN 1 ELSE 0 END), but I would like to calculate the percentage of approved Sales Orders only using a Saved Search.

A possible solution that I can see is to create the Saved Search with those two fields and a Script (Portlet / Suitelet) to run the Saved Search, calculate the value and display to the user. Does anyone know an easier way to achieve it, if possible, only using the Saved Search?

Thank you.

Best Answer

Actually this is possible. In a nutshell enter:

sum(case when {status} = 'Approved' then 1 else 0 end) / count({tranid})

as a Formula (Percent) column on a saved search and apply an aggregate function to it (Average, Maximum or Minimum all produce the same result)

see: Formula in Netsuite Saved Search

Related Topic