Monthly Sales By Geography
Hello All -
We would like to have a query that shows us monthly sales by geography (US State).
However, using the Bill To Address or the Ship To Address is a problem for us -- I won't get into the details but it doesn't serve our purposes very well.
Instead, we would like the location to be referenced from our account number. The first two characters of a BP's account number represents their state.
So, first step would be to consolidate sales for all BP's that share the same first two letters in their account number. This should, in theory, give us total sales for a particular state. Then, we would want to see a listing of that state's sales by month. So, result would be something like this:
Jan Feb Mar etc.
AK
AL
CA
Can anyone help with this?
Thanks!
Mike
I just randomly selected a year. You may change it to any year you want.
Freight is included. However, for adding Credit Memos I have to try more.
Try this:
SELECT P.[SalesSTATE],
[1] as [Jan],
[2] as [Feb],
[3] as [Mar],
[4] as [Apr],
[5] as [May],
[6] as [Jun],
[7] as [Jul],
[8] as [Aug],
[9] as [Sep],
[10] as [Oct],
[11] as [Nov],
[12] as [Dec]
FROM (SELECT Left(T0.CardCode,2) as [SalesState] ,
Case WHEN ISNULL(T1.DocTotal,0) !=0
THEN T1.DocTotal ELSE -T2.DocTotal END as [DocTotal],
CASE WHEN ISNULL(T1.DocTotal,0) !=0 THEN MONTH(T1.docdate)
ELSE MONTH(T2.docdate) END as [month]
FROM dbo.ocrd T0
LEFT JOIN dbo.oinv T1 ON T1.CardCode = T0.CardCode AND Year(T1.docdate)=2010
LEFT JOIN dbo.ORIN T2 ON T2.CardCode = T0.CardCode AND Year(T2.docdate)=2010
WHERE (T0.CardCode in (SELECT CardCode FROM OINV)) OR
(T0.CardCode in (SELECT CardCode FROM ORIN))) S
PIVOT (SUM(DocTotal) FOR [month] IN
([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
ORDER BY P.[SalesState]
Similar Messages
-
Report for monthly sales(sales office wise,sales group wise,plant wise)
Please send the Report for monthly sales(sales office wise,sales group wise,plant wise) with T.CODE.,
Hi
As per my knowledge there is no Standard Report in SAP based on sales office, sales group. and plant.
You may create your own report using MC18,MC21 and MC24.... Otherwise ask your ABAPer's help...
Muthu -
Time Series Line Chart - Monthly Sales - Make $0 or "No Sales" show up - not skipped
Post Author: kevinday17
CA Forum: Charts and Graphs
I have been messing with my chart for a while and I guess I'll just ask for help since I can't figure it out. All I am trying to do is chart out monthly sales dollars by customer. Simple enough...I have it working except I want to be able to see a $0 plotted on my graph when there were no sales in a month. Currently it just skips over that month and goes to the next where there is data (month after i.e next group summary field)). I've tried all sorts of ways of grouping. If I use the "group by date, monthly," on the "Order Date" field, I can't chose it as the "On Change of" under Advanced chart (single arrow is greyed out). So I ended up making a huge formula to make my own groups of months. My GH2 is the customer (and my chart), GH3 is my Grouping for month and year, and the detail is every single sales order. My graph points are based on summary data; sum of all the sales orders for that customer for that month.
How do I tell Crystal Reports that if there were no sales in December, then tell me 0. Don't just ignore it.
Maybe there is an option to make the X Axis Fixed with points (month-year, in order). It would be nice to have it uniform for every customer. I would love to see every graph that prints out have 36 x-axis coordinates; one for every month of the last 36 months (jan-05, feb-05, mar-05......dec-07) regardless of whether or not the customer had sales or not.
Thanks so much in advance.
KevinPost Author: V361
CA Forum: Charts and Graphs
I have CR XI, I created a formula and used it to create the chart section
if (isnull ()) then 0 else
So if your AMNT is a null value it should put 0, else the AMNT -
Hello All -
We use the below Query to find monthly sales for each of our stock units. However, it only provides the current year -- so for 2010, all our 2009 data is gone and the query just shows Jan 2010.
Is there any way to adjust this Query so that we can select the year we want to see?
Thanks!
Mike
SELECT T0.ITEMCODE,
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 1 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JAN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 2 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'FEB Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 3 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 4 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'APR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 5 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'MAY Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 6 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 7 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'JUL Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 8 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'AUG Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 9 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'SEP Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 10 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'OCT Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 11 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'NOV Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with
(NOLOCK) WHERE MONTH(T1.DOCDATE) = 12 AND T1.ITEMCODE
= T0.ITEMCODE AND YEAR(T1.DOCDATE) = YEAR(GETDATE())) AS 'DEC Amt'
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/*Hello there!!
you should try this code*/
SELECT T0.ITEMCODE, (SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 1
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'JAN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 2
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'FEB Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 3
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'MAR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 4
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'APR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 5
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'MAY Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 6
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'JUN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 7
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'JUL Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 8
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'AUG Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 9
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'SEP Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 10
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'OCT Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 11
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'NOV Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 12
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = (YEAR(GETDATE())-1)) AS 'DEC Amt'
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())-1) ORDER BY T0. ITEMCODE
thou i suggest that its more practical for you to use a variable to enter the year, for example like this.
declare @year as char(4)
set @year = '2009'
SELECT T0.ITEMCODE, (SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 1
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'JAN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 2
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'FEB Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 3
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'MAR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 4
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'APR Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 5
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'MAY Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 6
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'JUN Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 7
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'JUL Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 8
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'AUG Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 9
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'SEP Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 10
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'OCT Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 11
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'NOV Amt',
(SELECT SUM(T1.QUANTITY*T1.PRICE) FROM INV1 T1 with (NOLOCK) WHERE MONTH(T1.DOCDATE) = 12
AND T1.ITEMCODE = T0.ITEMCODE AND YEAR(T1.DOCDATE) = @year) AS 'DEC Amt'
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 ORDER BY T0. ITEMCODE -
Monthly Sales report of a given Year
Hi Experts,
I have a requirement that User enters Fiscal year in Selection Prompt, based on the year, user wants monthly sales like
Jan-2010 | Feb-2010 | March 2010 | ..........| Dec-2010
How can i get this?
My report layout is like
Vendor nbr Vendor name 201001 201002 201003 201004 201005 201006 201007 201008 201009
201010 201011 201012 Grand Total of sales revenue
Thanks
DavidHi David,
Can you add a column for Year?
If Yes, then you Section the Year column in the report. This will make the months appear below this specific year.
Then put the prompt for the Year. So when the user selects the year (eg: 2010), he will get all the months under the year 2010.
Thanks
Niranjan -
Hi All!
Is there any kind of report in SAP B1 that shows comparison of monthly sales year over year by state. So, for example, CA sales Jan-Dec 07 vs. Jan-Dec 08?
Thanks,
MikeHi Mike,
Only 3 types of reports built-in for sales analysis. Namely: By Customers, By Items or By Sales Employee.
You need either a XL Report or a query to define this report.
Thanks,
Gordon -
Monthly Sales By Sales Employee
Hello All!
Is there any report that shows Monthly sales by Sales Rep. So basically, consolidating all invoices for a rep by month. The headers would look like this:
Sales Rep...Jan...Feb...March...April...etc. Total
Thanks!
MikeHello Mike,
Please check the Sales Module > Sales reports > Sales Analysis > by Sales Employee tab.
You can select the Annual, Monthly, Qterly Report from the various options in the Selection creteria window.
Hope it solves the issue you are looking for.
Regards,
Jitin Chawla -
Monthly Sales Order query Doc Status problem
Hi Experts,
I am having an problem while making a total monthly sales order query in which I am not getting the document status which are Open - Printed. Also note that these document which are open printed are not having any target document.
SELECT T0.[DocStatus],T1.[TargetType],T0.[CANCELED],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName], T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name'
,T0.[discsum] FROM ORDR T0 ,RDR1 T1,OSLP T2,OCRD T3,OTER T4,NNM1 T5 where T0.DocEntry = T1.DocEntry AND T0.SlpCode = T2.SlpCode AND T0.CardCode = T3.CardCode
AND T3.Territory = T4.territryID AND T0.Series = T5.Series and T0.[CANCELED]='N' and T1.[TargetType] is not null
My mission for the above query is to have Total Monthly Sales Orders with value exluding the cancelled and closed sales sales ( close here means - which are manually done by right click on sales order screen and selecting Close )
Please guied how to solve this issue because in the back end for Sales Order which have turned to deleivery are showing doc status as closed and the sales order which are manually closed are also showing doc status as closed. How to diffrentiate between them.
Waiting for a positve feedback.
Regards,
RahulTry this one:
SELECT DISTINCT T0.[DocStatus],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName],
T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',
T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name',T0.[discsum]
FROM DBO.ORDR T0
INNER JOIN DBO.RDR1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN DBO.OSLP T2 ON T0.SlpCode = T2.SlpCode
INNER JOIN DBO.OCRD T3 ON T0.CardCode = T3.CardCode
INNER JOIN DBO.OTER T4 ON T3.Territory = T4.territryID
INNER JOIN DBO.NNM1 T5 ON T0.Series = T5.Series
where T0.[CANCELED]='N' and T1.[TargetType] != -1
Thanks,
Gordon -
Hello,
We are looking for a Query that will show all of our items and monthly sale by Qty and Amt. This includes items that do not have sales for that month - those fields would just be left blank.
So, header would be...
Item #...Jan Qty...Feb Qty...Mar Qty...etc...Jan Amt...Feb Amt...etc...
Does anyone know a Query that can do this?
Sales analysis will just show only items that have sold.
This is similar to Queries we have asked for in the past that shows all items.
Thanks!
Mikecreo que nececitan algo como esto:
DECLARE @FECHAINI DATE = '2015-01-01';
DECLARE @FECHAFIN DATE = '2015-02-28';
DECLARE @sql nvarchar(MAX) = '';
DECLARE @columns_1 nvarchar(MAX) = '';
DECLARE @columns_2 nvarchar(MAX) = '';
SET @columns_1 = STUFF(
SELECT DISTINCT
',Piezas_Mes' + cast( MONTH(DocDate) as varchar) + '_año_' + cast( YEAR(DocDate) as varchar)
FROM
(SELECT DocDate FROM OINV where DocDate BETWEEN @FECHAINI AND @FECHAFIN) AS P
FOR XML PATH('')
), 1, 1, '');
SET @columns_2 = STUFF(
SELECT DISTINCT
',Monto_Mes' + cast( MONTH(DocDate) as varchar) + '_año_' + cast( YEAR(DocDate) as varchar)
FROM
(SELECT DocDate FROM OINV where DocDate BETWEEN @FECHAINI AND @FECHAFIN) AS P
FOR XML PATH('')
), 1, 1, '');
SET @sql = N'
select
Z.PRODUCTO,
Z.DESCRIPCION,
' + @columns_1 + ',' + @columns_2 + N'
from
select
FROM
SELECT
a.ItemCode AS PRODUCTO,
a.Dscription AS DESCRIPCION,
''Piezas_Mes'' + cast( MONTH(b.DocDate) as varchar) + ''_año_'' + cast( YEAR(b.DocDate) as varchar) AS MES,
a.Quantity AS CANTIDAD
FROM INV1 AS a
INNER JOIN OINV AS b
ON a.DocEntry=b.DocEntry
INNER JOIN OCRD AS c ON b.CardCode = c.CardCode
WHERE b.DocType = ''I'' AND b.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
UNION ALL
SELECT
d.ItemCode AS PRODUCTO,
d.Dscription AS DESCRIPCION,
''Piezas_Mes'' + cast( MONTH(e.DocDate) as varchar) + ''_año_'' + cast( YEAR(e.DocDate) as varchar) AS MES,
(d.Quantity * -1) AS CANTIDAD
FROM RIN1 AS d
INNER JOIN ORIN AS e
ON d.DocEntry = e.DocEntry
INNER JOIN OCRD AS f ON e.CardCode = f.CardCode
WHERE e.DocType = ''I'' AND e.DocDate BETWEEN ''' + CAST (@FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
) as TABLADATOS
pivot
SUM(TABLADATOS.CANTIDAD) for TABLADATOS.MES IN(' + @columns_1 + N')
) as P
) as Z
inner join
select
from
SELECT
a.ItemCode AS PRODUCTO,
a.Dscription AS DESCRIPCION,
''Monto_Mes'' + cast( MONTH(b.DocDate) as varchar) + ''_año_'' + cast( YEAR(b.DocDate) as varchar) AS MES,
a.LineTotal AS TOTAL
FROM INV1 AS a
INNER JOIN OINV AS b
ON a.DocEntry=b.DocEntry
INNER JOIN OCRD AS c ON b.CardCode = c.CardCode
WHERE b.DocType = ''I'' AND b.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
UNION ALL
SELECT
d.ItemCode AS PRODUCTO,
d.Dscription AS DESCRIPCION,
''Monto_Mes'' + cast( MONTH(e.DocDate) as varchar) + ''_año_'' + cast( YEAR(e.DocDate) as varchar) AS MES,
(d.LineTotal * -1) AS TOTAL
FROM RIN1 AS d
INNER JOIN ORIN AS e
ON d.DocEntry = e.DocEntry
INNER JOIN OCRD AS f ON e.CardCode = f.CardCode
WHERE e.DocType = ''I'' AND e.DocDate BETWEEN ''' + CAST( @FECHAINI AS VARCHAR) + ''' AND ''' + CAST( @FECHAFIN AS VARCHAR) + '''
) as TABLADATOS
pivot
SUM(TABLADATOS.TOTAL) for TABLADATOS.MES IN (' + @columns_2 + N')
) as P
) as Y
on Z.PRODUCTO = Y.PRODUCTO and Z.DESCRIPCION = Y.DESCRIPCION
order by
PRODUCTO,
DESCRIPCION;';
EXEC sp_executesql @sql;
SALUDOS ... -
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 -
CURRENT YEAR PREVIOUS TWO MONTHS SALES+MDX
QUERY TO GET CURRENT YEAR LAST TWO MONTH SALES DYNAMICALLY IN MDX
assuming you are looking for data with the latest two months and taking adventure works DW 2008 as sample DB
try this
select [Measures].[Internet Sales Amount]
on 0,
{Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0),
Tail(nonempty(descendants([Date].[Calendar].[Calendar
Year],[Date].[Month of Year]))).item(0).prevmember}
on 1
from [Adventure Works] -
Previous month sales against each date
Hi all,
I am working on Bo XI 3.0.
I have a requirement where i need to display in table -"Date" then "sales" and against that in the same table "previous month's sales"
For e.x
date sales previous month's sales
01/04/08 45637 63536
02/04/08 73565 78556
and so on..
Any one having any clue please reply .
Thanks in advance,
Gaurav
Edited by: Gaurav Gayawar on May 22, 2009 7:23 PM
Edited by: Gaurav Gayawar on May 22, 2009 7:43 PMHi,
Can you go through the forum which has been answered:
How to calculate "Last Month Sales revnue"
Let me know if this works.
-Madhu. -
Calculate Last 12 months Sales
Hi Experts,
I need to have MAT value in Reporting.
MAT Value = Last 12 Months Sales Value/12.
How can i achieve this.
Please suggest the best way to have MAT value.
Thanks in advance,
RafiHi,
Create one restricted key fig by offsetting month for last 12 months and drag sales value key fig into that.
Now create a formula variable by dividing the newly created restricted key fig with 12.
hope it helps...
regards,
Raju -
hi, i am facing a problem in creation of sales order for a particular sales organization where in i need the sales orders raised by customers of the sales organization in a report which shows the sales order number,material data in it,quantity,cost,but my requirement to display the sales month wise for all customers .for example what r the sales orders raised in january by all customers of sales org should come under jan month,like what r the orders raised by customers in febraury in january month like this i need for a particular financial year ,my problem is i am unable to split the sales based on months,i am able to get all months sales order with out classification under one set.....if
HI RAJ,
this is sample code it may help u,
u do like this pass ktab to alv u got list by monthly.
but first field 'erdat' b/c we use this field i at end of.
types : begin of ty_vbak ,
erdat type erdat,
vbeln type vbeln_va,
end of ty_vbak.
data : itab type table of ty_vbak,
ktab type table of ty_vbak,
wa_itab type ty_vbak,
ty_wa_itaB TYPE TY_VBAK,
TEMP(2) TYPE C.
select vbeln erdat from vbak into CORRESPONDING FIELDS OF table itab
where vbeln > 100.
sort itab by erdat.
LOOP AT ITAB INTO WA_ITAB.
APPEND WA_ITAB TO KTAB.
AT END OF ERDAT+4(2).
CLEAR WA_ITAB.
APPEND WA_ITAB TO KTAB.
ENDAT.
ENDLOOP.
regards,
chandu. -
hi gurus,
can anyone tell me how to do monthly sales breakdown by product / product groups, distribution channel, custmer wise and by geographical area ( indicate quantity and value ), do we need to write abap programme, or can we do it by report painter, please suggest your prompt inputs,
regards,
rajenthe standard information system - in logistics - sales and distribution - give lot of combination- whether it is not satisfying the requirement???? Try these standard reports and take the decision on new module or new ABAP?
Maybe you are looking for
-
After installing a new hard drive in my 2011 macbook pro, I'm getting a apple.com/support -2003F error when trying to run the internet recovery. Any suggestions?
-
SOAP - XI - File (Sync)
Hi, I have a question about the SOAP -> XI -> File scenario. Normally it is quite simple if I have one File receiver here. My scenario is a bit different. The SOAP client need actually to get information from the File Payload. It is logically like th
-
Integrated speakers not working on MacBook 13" 10.5.8
Speakers are not working on MacBook 13" 10.5.8, however the startup chime does work. Plug-in headphones also work. Have searched all over google for answers but nothing fixes it. How do I check the drivers are correct? Thanks!!
-
X121e - How to enable WWAN/Bluetooth on Linux?
Hello everyone, does anyone know what the Lenovo Hotkey tool on Windows is doing technically behind the scenes to enable Bluetooth and the WWAN card? Does it connect on serial COM4 to the WWAN card and enter some AT commands to enable it? I hope it i
-
Is the new ios6 with siri working in ipad2?
Is the new ios6 with siri working in ipad2?