Year till Month sales in explorer

Hello EveryOne,
Have already searched forum before posting this.
Can someone please suggest me how to create year till month formula for Explorer.
( User do not want to configure and Index again for Prompt/Month )
Thanks and Regards,
Vaishali Wadhwa.

Hi,
In Business Objects Explorer we can perform only direct aggregation. If we want to create a Year till month formula we need to create at Universe only.
Regards,
Sundar

Similar Messages

  • Compare month sales with previous year same month sales

    hi all.
    we need to compare given month of this year with same month of last year. we need to compare sales quantity and value.
    the query is on 0RT_C40 multiprovider. We have tried all options using 0Calmon, calday, fiscal year... but whenever we specify offset, we are not getting data. there is valid data for previous year.
    plz let us know what else to do? check with 0RT_C40.
    thanks in advance.
    regards: gaurave

    Gaurave,
    Are you selecting the time period in a selection in columns or rows, or are you selecting the time period in the Filter or Free Characteristic area.
    When you make the initial selection of say Period 11.2007 in the Free Characteristic area, and then within a selection but on an offset to derive 11.2006, the fact that you have made your selection of 11.2007 in the Free Char area will restrict the entire query results to this time period.
    Both your picks on time should be in selections in the Columns or the Rows.
    Regards
    Gill

  • Monthly Sales Report - Prior year comparison

    I am created a monthly sales report for Sales in Crystal 2011. I have a parameter prompting for a date e.g. 02/01/2014 to 02/28/2014. I would like to have the sales amounts beside this column for 2013.
    I found this formula but I can only get my results from 2014.Anyone have an idea how I can do this ?
    Thanks,
    debbie
    \\Current Period
    If pwformatdate({OEAUDH.TRANSDATE})
    in date(year(currentdate)-(if month(currentdate)<10 then 1 else 0),10,1)
    to currentdate
    then Amount Forumula
    else 0.00
    \\Prior Year Period
    If pwformatdate({OEAUDH.TRANSDATE})
    in date(year(currentdate)-(if month(currentdate)<10 then 2 else 1),10,1)
    to dateadd('yyyy',-(if month(currentdate)<10 then 2 else 1),currentdate)
    then Amount Formula
    else 0.00
    the parameter for my date is :
    pwformatdate({OEAUDH.TRANSDATE}) >= {?FromDate} AND
    pwformatdate({OEAUDH.TRANSDATE}) <= {?ToDate} AND
    ({ICITEM.ITEMNO}) >= ({?FromItem}) AND
    ({ICITEM.ITEMNO}) <= ({?ToItem}) and
    {OEAUDH.TRANSTYPE} <> 3

    Hi Debbie,
    1) Modify the Record Selection Formula to;
    {OEAUDH.TRANSDATE} IN [cdate(year({?FromDate})-1, Month({?FromDate}), day({?FromDate})) TO cdate(year({?ToDate})-1, Month({?ToDate}), day({?ToDate}))]
    OR
    {OEAUDH.TRANSDATE} IN [{?FromDate} TO {?ToDate}]
    This should give you current and previous year's data for the period chosen by the user.
    2) Assuming you have a group on the Date field set to print for each year, simply create a running total from the Field Explorer.
    Name it Current Year.
    Choose 'Sales Amount' as the field to Summarize.
    Choose 'Sum' as the Summary Operation.
    Under 'Evaluate', select 'use a formula' and use this code:
    date_field IN
    [cdate(year({?FromDate}), Month({?FromDate}), day({?FromDate})) TO cdate(year({?ToDate}), Month({?ToDate}), day({?ToDate}))]
    Set it to Reset at each Group For Year
    3) Create another Running Total and call it 'Previous Year'.
    Everything remains the same from Step 2 except the evaluate formula:
    date_field IN
    [cdate(year({?FromDate})-1, Month({?FromDate}), day({?FromDate})) TO cdate(year({?ToDate})-1, Month({?ToDate}), day({?ToDate}))]
    Hope this helps.
    -Abhilash

  • 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
    David

    Hi 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

  • 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]

  • Loop through month and year till date while using a merge statement

    Hello Guys,
    I have 2 tables with the following datas in them:-
    Company
    CompanyId CompanyName
    1                 Company1
    2                 Company2
    3                 Company3
    Employees
    EmployeeId EmployeeName CompanyId StartDate
    1                  Employee1        1                 12/21/2011
    2                  Employee2        1                 01/20/2012
    3                  Employee3        2                 03/23/2012
    4                  Employee4        2                 07/15/2012
    5                  Employee5        2                 01/20/2013
    6                  Employee6        3                 12/17/2013
    Now i want to check, How many people were recruited in the team in the specified month and year? I have the storage table as follows:-
    RecruiterIndicator
    CompanyId Year Month EmployeeRecruited
    1                 2011 12      1
    1                 2012 1        1
    2                 2012 3        1
    2                 2012 7        1
    2                 2013 1        1
    3                 2013 12      1
    This should be a merge stored procedure that should update the data if it is present for the same month year and company and insert if that is not present?
    Please help me with this
    Thanks
    Abhishek

    It's not really clear where the merge to come into play. To get the RecruiterIndicator table from Employess, this query should do:
    SELECT CompanyId, Year(StartDate), Month(StartDate), COUNT(*)
    FROM   Employees
    GROUP  BY CompanyId, Year(StartDate), Month(StartDate)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • I need to display all the previous months sales.

    Hi Gurus,
    I have a requirement were i need to display all the previous months sales.
    i.e if a user enters sept 2011, then in report it should display from April 2011(which is the first month of fiscal year).h
    and also it should display total sales in another column till that month.
    Regards
    Arun

    Hi,
    Part 2 and Part 3 of the document.
    Link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f002c608-2533-2c10-25a1-d0e7f7b5b662?QuickLink=index&overridelayout=true]
    Link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10fc4382-afa6-2c10-1380-fa224fe4324f?QuickLink=index&overridelayout=true]
    Documents by 'Surendra Kumar Reddy Koduru' are always useful. Try to go through all of them.
    All the best!!!

  • 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. 
    Kevin

    Post 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

  • Help With Monthly Sales Query

    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

    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,
    Mike

    Hi 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 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]

  • Monthly Sale By Item

    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!
    Mike

    creo 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 ...

  • Year to date sales

    I'm trying to calculate year to date sales value. If I have more than one packet size my values do not match expected results. Is there a way I can have all data in single packet in start routine or end routine. I don't want to make cahnge to setting in DTP. My initial package should pick all values.
    For example:
    Comp Month Sales
    A        1         1
    A        2         2
    A        3         3
    A        4         4
    A        5         5
    A        6         6
    A        7         7
    A        8         8
    My expected result should be:
    A        1         1
    A        2         1 + 2 = 3
    A        3         3 + 3 = 6
    A        4         6 + 4 = 10
    A        5         10 + 5 = 15
    A        6         15 + 6 = 21
    A        7         21 + 7 = 28
    A        8         28 + 8 = 36
    If I have two packets ( size 4each) then my calculation doesn't match the expected results
    A        1         1
    A        2         1 + 2 = 3
    A        3         3 + 3 = 6
    A        4         6 + 4 = 10
    A        5          5
    A        6         5 + 6 = 11
    A        7         11 + 7 = 18
    A        8         18 + 8 = 26
    Can any one hlep me to resolve this issue.

    Hi,
    The best way is....
    Create a report and calculate it in Report like below.
    Create a Customer Exit Variable called FMYEAR on 0CALMONTH and then write code like below.
    DATA :  l_s_range TYPE rsr_s_rangesid,
                loc_var_range LIKE rrrangeexit,
                zbdatj LIKE t009b-bdatj,
               zbuper LIKE t009b-poper,
    First Month Of Current Fiscal year comment*
        WHEN 'FMYEAR'.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                 EXPORTING
                   i_date               = sy-datum
            I_MONMIT             = 00
                   i_periv              = 'V3'
                IMPORTING
                  e_buper              =  zbuper
                  e_gjahr              =  zbdatj.
          CLEAR: l_s_range.
          l_s_range-low+4(2) = '04'.
          l_s_range-low+0(4) = zbdatj.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    and then create a restricted Kefigure with 0CALMONTH and value, and restrict calmonth with FMYEAR;0CALMONTH (there are variables and the values are  in between FMYEAR;0CALMONTH)
    Thanks
    Reddy

  • Show statistics of year against month in cross tab

    Dear All,
    I want to create a report to show some statistics (measure), e.g. sales revenue of different year and month in cross tab format, i.e. year as the vertical axis and month as the horizontal axis. So that I can compare the revenue of specific among different years and show the tendency for analysis.
    However, what I got the statistics is being grouped by the year (vertical axis) only and being the same across month ( horizontal axis).
    should any coding be added to achieve such purpose? Please kindly advise.
    Thanks and Regards,
    Cherry

    OK, let me explain in this way.
    I have a table:
    FiscalYr-Month(yyyymm)-Sales
    -2006-200601--
    1,000,000
    -2006-200602--
    1,000,100
    -2006-200603--
    1,000,200
    -2007-200701--
    1,001,000
    -2007-200702--
    1,001,100
    -2007-200703--
    1,001,200
    and in the report, i want to compare the data in format of crosstab as follow:
    -FiscalYr\Month---01+02+03--
    +
    --2006----------1,000,000+---1,000,100+---1,000,200--
    +
    --2007----------1,001,000+---1,001,100+---1,001,200--
    +
    -Sum/Diff/Avg-.................
    So that I can compare the trend of sales of same month against different years.
    The original data saves month in format of yyyymm instead of the month number to ease some of calculations of another module. Still, there is a time dimension table which can convert yyyymm to month number. Therefore I thought it should be possible to display month in number in the report.
    However, what I get now, the sales are being grouped by the Fiscal Yr like this:
    -FiscalYr\Month---01+02+03--
    +
    --2006----------3,000,300+---3,000,300+---3,000,300--
    +
    --2007----------3,003,300+---3,003,300+---3,003,300--
    +
    -Sum/Diff/Avg-.................
    I am not sure if there is something wrong in my structure (now year and month and 2 dimensions) or I can make use of some formula/coding in the report (or universe?).
    Please kindly give me some idea.
    Thanks a lot.
    Cherry
    Edited by: Cherry Wan on Jun 2, 2009 3:23 AM

Maybe you are looking for

  • Adobe Premiere 6.0 and Windows 7

    OK Folks Don't laugh but has anyone tried to install good old Premiere 6.0 on a PC that is running Windows 7? I would appreciate any advice - even "it simply will not work" LoL Many thanks Brian Emmis

  • Running Leopard on one partition and Tiger on another partition?

    I have recently purchased a family pack of Leopard, and I am reading up on a lot of the posts, here, before I venture the installation on two machines. I intend to install Leopard one machine at a time and give a few weeks between installations. One

  • Using the system variable cpInfoQuizAttempts

    My content is run through an LMS. I am trying to used advanced code using the system variable cpInfoQuizAttempts so that a caption appears when the variable value = 3. Apparently, I can't utilize the value of this variable; in fact, I can't even disp

  • Semiweekly Time Series Creation for DP

    Hi, I want to create a semiweekly (twice a week) time series for DP. And this would be spread for 2 years (i.e. 1 year for the past and 1 year for the future). So a total of 208 entries need to be made for this time series. My understanding of the me

  • Slow start up on Satellite Pro A60

    My Satellite Pro A60 EN takes ages to be able to use from inital start up and also when swopping users. I reckon about 12 minutes before you can use it from switching on.