2 weeks ago
HANA B1 v10
I have built the query below, but the "YTD Sales" total doesn't seem to match the data from our Sales Analysis for the last 365 days for a few items. Am I using the SUM function incorrectly there? (My thinking was that it would SUM the total units sold in the last 365 days.) Or is it that the Sales Analysis and my query are reflecting different inputs?
SELECT T0."ItemCode", T1."ItemName",T1."CodeBars", (T1."OnHand"-T1."IsCommited") AS "Available", T1."OnHand" AS "On Hand",T1."IsCommited" AS "Committed", T1."OnOrder" AS "Ordered", T1."LastPurPrc" AS "Last Purchase Price", sum(T0."Quantity") AS "YTD Sales"
FROM RDR1 T0 INNER JOIN OITM T1 ON T0."ItemCode" = T1."ItemCode"
WHERE T0."DocDate" between ADD_DAYS(CURRENT_DATE, -365) and CURRENT_DATE AND T1."QryGroup8" = 'Y'
GROUP BY T0."ItemCode", T1."ItemName", T1."CodeBars", T1."OnHand", T1."IsCommited", T1."OnOrder", T1."LastPurPrc"
ORDER BY T0."ItemCode"
User | Count |
---|---|
96 | |
8 | |
6 | |
5 | |
5 | |
4 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.