Qty sales & month
Dear Forums,
If i want to get this report for This month so far ;
item code, item description, DocDate,stock on hand, Qty sales, Turn over, Turn over days
eg . April 20,
542514 / MILK/ 11-05-09 / 40 / 10 / 2.66666 / 80 / 20 / 30
542518/ SOAP/ 11-05-09 / 40/ 10 / 2.66666 / 80 / 20 / 30
can any one show me the query? thanks
Edited by: rachelhel on Apr 22, 2009 7:48 AM
Edited by: rachelhel on Apr 22, 2009 10:38 AM
Hi ,
Please try this .....
SET ARITHABORT OFF SET ANSI_WARNINGS OFF
SELECT T0.ItemCode, T0.Dscription,T1.OnHand, convert(varchar,SUM(T0.BaseQty*T1.NumInSale)) AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,convert (varchar,(t1.onhand/(SUM(T0.BaseQty*T1.NumInSale)/DAY(GetDate())* Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END)))AS 'TURN OVER IN MONTH'
FROM DBO.INV1 T0 INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE Month(T0.DocDate) = Month(GetDate()) AND Year(T0.DocDate) = Year(GetDate())
GROUP BY T0.ItemCode,T0.Dscription,T1.OnHand
union
SELECT T1.ItemCode, T1.itemname,T1.OnHand, '' AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,'No Sales' AS 'TURN OVER IN MONTH'
FROM DBO.OITM T1
WHERE T1.ITEMCODE NOT IN (SELECT ISNULL(ITEMCODE,0) FROM INV1)
GROUP BY T1.ItemCode,T1.itemname,T1.OnHand
ORDER BY 1
Similar Messages
-
hai all Expert..,
I have a problem with my Query .., may have that can help me.
I create a Query for Qty sales, after I was working Excecute
but after I check the results one by one with the sales results
of the analysis appeared to have all that is not the same as the results of the analysis in sales
SELECT T0.ItemCode, T0.Dscription,T1.OnHand,T0.DocDate,T0.ActDelDate, SUM(T0.BaseQty * T1.NumInSale) AS 'Qty Sales' ,DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
FROM DBO.INV1 T0 INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE
T0.ItemCode ='01000006' and
(Month(T0.DocDate) = Month(GetDate())-1) AND Year(T0.DocDate) = Year(GetDate()) and
(T0.BaseQty * T1.NumInSale)>0
GROUP BY T0.ItemCode,T0.Dscription,T1.OnHand,T0.DocDate,T0.ActDelDate
ORDER BY T0.ItemCode,T0.DocDate
Thanks...Try This
SELECT T0.ItemCode, T0.Dscription,T1.OnHand,T0.DocDate,T0.ActDelDate, SUM((T0.Quantity * T1.NumInSale)-T1.OPENQTY) AS 'Qty Sales'
,DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
FROM DBO.INV1 T0 INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE
T0.ItemCode ='01000006' and
(Month(T0.DocDate) = Month(GetDate())-1) AND Year(T0.DocDate) = Year(GetDate()) and
(T0.BaseQty * T1.NumInSale)>0
GROUP BY T0.ItemCode,T0.Dscription,T1.OnHand,T0.DocDate,T0.ActDelDate
ORDER BY T0.ItemCode,T0.DocDate -
Calculate gross profit, yearly sales,monthly sales,weekly sales?
hi all
i try to create procedures according to these conditions
What are my yearly sales?
What are my monthly sales?
What are my weekly sales?
What are my daily sales?
What is my Gross Profit?
What is my Gross Sales?
this is star schema
now how i calculate yearly sales, monthly sales, and also gross profit.
create procedure spgrossprofit
as
select as grossprofit from dimfact
now which aggregate function i use for calculate above conditions?
any help?Sorry(ETC) is a Spanish expression = the same for the next option
The correct query:
Year/Month
create procedure spyearlysales
as
select sum(totalsales),Year(Dimtime.date) from Dimtime
inner join Dimfact on Dimtime.Time_Key=dimfact.Time_Key
group by Year(Dimtime.date)create procedure spmonthsales
as
select sum(totalsales),year(Dimtime.date),Dimtime.Month from Dimtime
inner join Dimfact on Dimtime.Time_Key=dimfact.Time_Key
group by Year(Dimtime.date),Dimtime.Month
JM Claudio Dba/Consultor SQL/BI Pasiona - Spain -
Summ a measure over 12 months for a specific sales month
Hi
I have been trying to Sum a measure (Income) over the next 12 months (Date) for a specific sales month (SalesDate)
This query at least returns values but does not limit the measure to the first 12 months:
With
Member [Measures].[Income - plus 12] As
Iif(
[Date].[|Date - Month Description].CurrentMember>=[SalesDate].[SalesDate - Month].CurrentMember
, Sum(LastPeriods(- 12
, [Date].[Date - Month Description].CurrentMember
[Measures].[Income]
) HINT STRICT
, Null
Select
[SalesDate].[SalesDate].&[2014]
Except([SalesDate].[SalesDate - Month].[SalesDate Month]
, [SalesDate].[SalesDate - Month].[All].UNKNOWNMEMBER
} on Columns
, [Measures].[Income - plus 12] on Rows
From [My Cube]
So I tried this query but it returns nulls:
With
Member [Measures].[Income - plus 12] As
Sum(
(LinkMember([SalesDate].[SalesDate - Month].CurrentMember
, [Date].[Date - Month Description]
LinkMember(
ParallelPeriod([SalesDate].[SalesDate - Month].[SalesDate Month]
, -12
, [SalesDate].[SalesDate - Month].CurrentMember
, [Date].[Date - Month Description]
,Root([SalesDate])
[Measures].[Income]
Select
[SalesDate].[SalesDate].&[2014]
Except([SalesDate].[SalesDate - Month].[SalesDate Month]
, [SalesDate].[SalesDate - Month].[All].UNKNOWNMEMBER
} on Columns
, [Measures].[Income - plus 12] on Rows
From [My Cube]
I would appreciate any input (urgently as I have been fighting with this for a week now)Hi Simon
Thank you for your reply! I hope this will shed some light:
In the original question, I tried to make the query generic but here is the actual issue:
Ok, I can't upload images as my account has not been verified but this code returns the total prem for inception date January 2014 but includes values in 2015:
With
Set
[Inception - plus 12]
As
LinkMember([Inception Period].[Inception
Year - Month]
, [Loss Ratio Period].[Loss Ratio Year - Month Description])
LinkMember(ParallelPeriod([Inception
Period].[Inception Year - Month].[Inception Month]
, -12, [Inception Period].[Inception Year - Month] )
, [Loss Ratio Period].[Loss Ratio Year - Month Description])
Member
[Measures].[Total Prem - plus 12]
As
sum({ [Inception - plus 12] }
, [Measures].[Total Prem] )
Select
[Inception Period].[Inception Year].&[2014]
*[Inception Period].[Inception Year - Month].[Inception Month]
onColumns
, [Measures].[Total Prem - plus 12]
onRows
From
[Loss Ratio Cube]
So the result for January 2014 includes the Total Prem received in Jan and Feb 2015. So the code under your suggestion, however, the result is now (null)
With
Member
[Measures].[Total Prem - plus 12]
As
sum({LinkMember([Inception
Period].[Inception Year - Month]
, [Loss Ratio Period].[Loss Ratio Year - Month Description])
LinkMember(ParallelPeriod([Inception
Period].[Inception Year - Month].[Inception Month]
, -12, [Inception Period].[Inception Year - Month] )
, [Loss Ratio Period].[Loss Ratio Year - Month Description])
, [Measures].[Total Prem] )
Select
[Inception Period].[Inception Year].&[2014]
*[Inception Period].[Inception Year - Month].[Inception Month]
onColumns
, [Measures].[Total Prem - plus 12]
onRows
From
[Loss Ratio Cube] -
COPA from Billing seperate sales rev qty & sales return qty
Dear Experts,
If we need to seperate sales rev qty & sales return qty, how do we send sales rev qty & sales return qty by billing type?
Thanks in advance.HI,
I assume you want to post the sales rev. qty / sales return qty. You can use enhancement COPA005 (include ZXKKEU08) to move actual values/quantities to other value/quantity fields if you have a rule for that.
I guess you can use the SD document category which is assigned to every billing type to differentiate between sales postings and sales return postings. This is more stable than focussing on the billing type itself (where a new one is created easily but nevertheless it must be assigned to an existing SD document category).
best regards, Christian -
Ran this Query below and it pulled up redundant data for Jan and June?! Anyone know how to correct? Should be just Jan 2010.
Thanks,
Mike
SELECT T0.ITEMCODE,
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 1 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JAN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 2 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'FEB QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 3 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 4 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'APR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 5 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAY QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 1 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 7 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUL QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 8 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'AUG QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 9 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'SEP QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 10 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'OCT QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 11 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'NOV QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 12 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'DEC QTY'
FROM [dbo].[OITM] T0
LEFT JOIN [dbo].[INV1] T1 ON T1.ItemCode = T0.ItemCode
WHERE T0.SellItem = 'Y'
GROUP BY T0.ItemCode,YEAR(T1.DOCDATE) HAVING YEAR(T1.DOCDATE) = YEAR(GETDATE())
ORDER BY T0. ITEMCODEMike,
I notice that for the Month of June the MONTH(T1.DOCDATE) = 1 is pointing to Jan which I corrected to 6 in the query below.
SELECT T0.ITEMCODE,
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 1 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JAN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 2 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'FEB QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 3 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 4 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'APR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 5 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAY QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 6 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 7 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUL QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 8 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'AUG QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 9 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'SEP QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 10 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'OCT QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 11 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'NOV QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK)
WHERE MONTH(T1.DOCDATE) = 12 AND T1.ITEMCODE =
T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'DEC QTY'
FROM dbo.OITM T0
LEFT JOIN dbo.INV1 T1 ON T1.ItemCode = T0.ItemCode
WHERE T0.SellItem = 'Y'
GROUP BY T0.ItemCode, YEAR(T1.DOCDATE) HAVING YEAR(T1.DOCDATE) = YEAR(GETDATE())
ORDER BY T0. ITEMCODE
Suda -
Hi expert...
I have a problem ..,
I have to report sales to the Quanty Query ..,
but why after I check in the amount of System Analys Qty Salesnya different with my report.
I find based on all WHERE (MONTH(DocDate) not match as well as based on WHERE (MONTH(ActDelDate),
how do I make the same Querynya to
Thank you for helping me ...Hi Expert M. Jenkins
I not, to reduce the credit service / item documents in my Query.
in making this report a lot of my problems ... This one's my problem,
you can help me in this case .. because I have tried repeatedly check the results in sales but not the
same analysis with the results of my queries,
why this can happen?
thanks a lot...
rachelhel -
Query for Opening Stock + Purchase Qty + Sales Qty
Hi ,
Can anyboday help me by how to develop a query for the following requirement. If any custom query is available please provide me .We are working on SBO 2007B PL 8. The required report structure is
ItemNo ***OpeningStock**** Purchase ********* Sales****
(Batchwise)** Qty*** Value ****Qty** Value ***Qty***Value
Thanks & Regards
SriniHi Srini,
I found this on the forum, see if it helps you;
select b.Itemcode,b.Item_Description,b.UOM, b.rate as Rate,b.Opening_Stock,b.Receipt,b.Issue, b.Material_Revalue,b.Closing_Stock,b.Closing_Value from (select *,(case closing_stock when 0 then 0 else(Closing_Value/Closing_Stock)end) as Rate from( SELECT T0.Itemcode as 'Itemcode' ,min(T0.Dscription) as 'Item_Description', max(T1.InvntryUom) as UOM, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,59,20,16,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0)+ (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0)))as Opening_Stock, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (20,18)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (67)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (58,59,16,14)),0)) as Receipt, (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (13,15)),0) + isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (67)),0)+ isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (58,60,21,19)),0)) as Issue, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (162)),0) as Material_Revalue, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,59,20,16,14,19,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0))as Closing_Stock, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,18,-2,67,59,20,16,14,15,13,21,19,60,69,162)),0) as Closing_Value FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod where ((B1.ItmsGrpNam>='[%2]' and B1.ItmsGrpNam<='[%3]') or ('[%2]'='' and '[%3]'='')) GROUP BY T1.itemcode,T0.Itemcode )a Where (a.Opening_Stock + a.Receipt + a.Issue + a.Material_Revalue + a.Closing_Stock + a.Closing_Value) <> 0 )b
Thanks,
Joseph -
Inventory qty, Sales Qty, Planning Qty difference
Our customers order by the number of containers they want, we sell by the amount of lbs of liquid we put into the containers (never the same amount), we plan by the standard amount of liquid that could theoretically can fit into the container and adjust the invoice after the container is weighed going out the door.
Is there a way that the sales order has a quantity of 1 container, the number of theoretical lbs would be stated on the order (35,000 lbs), the price would be per lb, the total would be 35,000 x the price. The planning would be done by the number of containers, but MRP would look at the number of lbs needed to be produced. Example we need 5 containers but MRP would state 175000 lbs.
Regards,
FredHi Fred.......
Have you ever used Factors in Item Master Data?
It takes effect in sales order and in MRP. It will work like it you put 1 Container automatically it gets Converted into 35000lbs....
Please check that......
Regards,
Rahul -
Report: GR Qty, IR Qty for Month (Dates Wise).
Hi All,
Where can I found Goods Receipt Quantity, Invoice Receipt Quantity for a Particular Period (Dates).
MB5S is not coming as per dates.
Is there any other report which will meet the above requirement ?
Thanks & Regards,
Anand.Dear, Use ME80FN and in Change View use Purchase Order History. Both GR & IR appears here.
Sort it out as per your parameters.
If it helps, Kindly give points.
Regards,
RM -
Pivot sales analysis report by day for a particular month - sap has by month and annual
Hi guys,
I'm trying to come up with a pivot sales analysis query report for items for the month by displaying individual days sales, sales amount, gross profit, gross profit %
e.g
Month of March
1st, 2nd, 3rd, 4th.....31st march. In sap their is a sales analysis report by
days of the month
1st March
2nd march
31st march
item no
item description
Qty
sale amount
gross profit
gross profit%
qty
sale amt
gross profit
gross profit %
Qty
sale amt
gross profit
gross profit %
sugar
20
20,000
5,000
25
30
30,000
10000
33.3
40
40000
15000
37.5
n02
n03
no4
Regards BrianHi,
Due to pivot limitation, not possible to get above data in pivot table.
Try this simple query which matches system sales analysis by item.
SELECT t1.itemcode as Itemcode, T1.[Dscription] as 'Item description', sum(T1.[Quantity]) as Qty, sum(T1.[LineTotal]) as 'sales amount', sum(T1.[GrssProfit]) as 'Gross Profit'
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE month( T0.[DocDate]) = '1' and year( T0.[DocDate]) =2014 GROUP BY T1.[ItemCode], T1.[Dscription]
Thanks & Regards,
Nagarajan -
ANNUAL SALES REPORT (MONTH WISE)
Hi,
I have following query, which shows annual sales (month wise). But when i run this query it shows all the parts (my mass production and Spare parts as well). I want it should show only MASS Production items only.
The differencation i have specified at Item level property. If item property no. 5 (name SPARES) is check then it is SPARE item otherwise it is MASS Production.
Thanks,
Vincent
======================================================
SELECT T0.ITEMCODE, T0.ItemName, T0.U_MODEL,
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 1 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JAN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 2 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'FEB QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 3 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 4 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'APR QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 5 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAY QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 6 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUN QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 7 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUL QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 8 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'AUG QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 9 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'SEP QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 10 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'OCT QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 11 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'NOV QTY',
(SELECT SUM(T1.QUANTITY) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 12 AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'DEC QTY'
FROM dbo.OITM T0
LEFT JOIN dbo.INV1 T1 ON T1.ItemCode = T0.ItemCode
WHERE T0.SellItem = 'Y'
GROUP BY T0.ItemCode, T0.ItemName, T0.U_MODEL, YEAR(T1.DOCDATE) HAVING YEAR(T1.DOCDATE) = YEAR(GETDATE())Hi Rahul,
Yes this report is very much available, but my idea was to integrate an udf (Model No., which i didn't specify in this query).
But yes this report is very usefull for me.
Thanks
Vincent -
Dear Forums,
If i want to get this report ;
Item Code / Qty Sales (accumulate this month) / Days (how many days till this month) / Total days in this month
eg . April 21
542514 / 2.563 / 21 / 30
can any one show me the query? thanksThe "Union" is to list the all the items which has stock >0 and items not in Invoice
SET ARITHABORT OFF SET ANSI_WARNINGS OFF
SELECT T0.ItemCode, T0.Dscription,T1.OnHand, convert(varchar,SUM(T0.BaseQty*T1.NumInSale)) AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,convert (varchar,(t1.onhand/(SUM(T0.BaseQty*T1.NumInSale)/DAY(GetDate())* Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END)))AS 'TURN OVER IN MONTH'
FROM DBO.INV1 T0 INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE Month(T0.DocDate) = Month(GetDate()) AND Year(T0.DocDate) = Year(GetDate())
GROUP BY T0.ItemCode,T0.Dscription,T1.OnHand
union
SELECT T1.ItemCode, T1.itemname,T1.OnHand, '' AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,'No Sales' AS 'TURN OVER IN MONTH'
FROM DBO.OITM T1
WHERE T1.ITEMCODE NOT IN (SELECT ISNULL(ITEMCODE,0) FROM INV1)
AND T1.ONHAND>0
GROUP BY T1.ItemCode,T1.itemname,T1.OnHand
ORDER BY 1
Please let me know whether out is correct. If so i will try to include the A/R Credit Memo also -
Qty Sold Via Month Via Stock Item
Hi All,
I am trying to write a formula that will show in a cross tablular format the Qty Sales via Month. (please note i can not use a cross tab report due to formatting issues). My report so far looks like this.
Group Header 1 = Stock Category Group ie Milk, Cheese, Bread etc
Group Header 2 = Stock Code
Details = Transaction Line information from invoices Qty sold, Date, Month No, Month Name
Group Header 2 = Stock Code Group
Header 1 = Stock Category Group ie Milk, Cheese, Bread etc
In Footer 2 (Stock Code) I have added 12 formula one for each month:
This is the one for February
if {@MONTH} = 2 then
Sum ({@TLqty}, {TransactionLines.IdxStockCode})
I get a total but its for ALL the Months for that Stock Item??
please help thanks
MikeCan you group by month, and put the formula there?
or, if that does not work well, try a running total, use the same type of formula,
and you can reset on change of month. Failing that, can you post some sample data. -
How to calculate the sales in the last month of last year
Hi all,
I have a requirement need to implement ,
the report has three columns,
MONTH----SALES----SALES2
201201----10------------100
201202----20------------100
201203----30------------100
201204----40------------100
201205----50------------100
The Sales2 is the sales of last month of last year, that is sales in 201112, value is 100.
How to realize this requirement ?
thank you in advance!!!sorry,
I think you maybe not understand my requirement.
What I want to implement as follow,
MONTH----SALES----SALES2
201201----10------------100 (This is 201112's Sales)
201202----20------------100 (This is 201112's Sales)
201203----30------------100 (This is 201112's Sales)
201204----40------------100 (This is 201112's Sales)
201205----50------------100 (This is 201112's Sales)
201206----60------------100 (This is 201112's Sales)
If I set SALES2 =AGO(SALES,MONTH, <number of period>)
how can I set <number of period> ?
201201 should mapping to 201112
201202 also mapping to 201112
201203 also mapping to 201112
201204 also mapping to 201112
201205 also mapping to 201112
201206 also mapping to 201112
Maybe you are looking for
-
If I went in to an Apple Store would they be able to restore it for me?
-
I am using iDVD '11 to create projects. My current one (as with all of the past projects) is using the Revolution Chapters theme. I am adding audio to the titile screen, as well as 2 videos into the 2 drop boxes. I added 2 HD iMovies. All of my burni
-
I can't delete QQ software either from mobile or itunes
Dear Sir, I upgrated QQ software from 21st Sept. last Saturday. But this QQ software can't be upgrated, so I can't use this software anymore. I keep contacting with QQ software Company, they informed me I can deleted directly from My mobile from Gene
-
How to delete one of your photo albums but doesn't have a red thing
I went on my friend's computer to download my pictures from my pervious phone, I noticed that the pictures came up twice in 2 different albums. It won't allow me to delete on or both of the albums. Also when I take a picture it goes into a third albu
-
Hi everybody, I want to lock a client for a period of time. How can I do it? Thanks in advance venkatesh