Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Gross profit Percentage calculation in SAP B1 query

Hi...

i am writing a query with the sales for particular customer and in a particular year for a particular product.

SELECT Distinct(T1."ItemCode"), T1."Dscription",SUM(T1."Quantity"),SUM(T1."LineTotal"),SUM(T1."GrssProfit" )

FROM "STC_LIVE"."OINV"  T0 INNER JOIN "STC_LIVE"."INV1"  T1

ON T0."DocEntry" = T1."DocEntry"

WHERE T0."CardCode" = '12345' and  YEAR(T0."DocDate") = '2015'

GROUP BY T1."ItemCode", T1."Dscription"

Its giving me right output.

But now i want to add one  more column in the query to calculate gross profit

which would be SUM(T1."GrssProfit" )/SUM(T1."LineTotal") * 100 .

how can i write it in query and how can i make sure division by zero overflow does not happen?

Regards,

Anjana

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question