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

Similar Messages

  • YTD(year to date) Sales [List Price/ Gross Sales ]

    How to create YTD(year to date) Sales [List Price/ Gross Sales ] depending on the selection in filter

    Do you have the measure names as list of values in prompt?
    Rgds,
    Dpka

  • Year-To-Date Sales by month calculation in cube

    Hi everyone,
    I want to already calculate the 'YTD Sales'by month in my cube, so I increase performance when the user is running his report. YTDSALES = Actual Month Total Sales + Previous month YD Total Sales.
    Not sure how to implement it in the update rule. Looks like a lt of coding. Any suggestions would be greatly appreciated.
    Thanks, RL

    You should do a little loop in the start routine and write all the monthly values into any periods up to period 12. The coding could look like:
    data: l_d_data_package like line of data_package,
          l_t_data_package TYPE STANDARD TABLE OF 
                           DATA_PACKAGE_STRUCTURE
                           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
      loop at data_package into l_d_data_package.
        l_d_data_package-/bic/ytdsales =
             l_d_data_package-/bic/sales. "or other keyfig
        while l_d_data_package-calmonth+4(2) <= '12'.
          append l_d_data_package to l_t_data_package.
          clear l_d_data_package-/bic/sales. "or other keyfig
          l_d_data_package-calmonth+4(2) =
             l_d_data_package-calmonth+4(2) + 1.
    *     If you have fiscper or fiscper3 or
    *     calquarter you may need to adjust it here too.
        endwhile.
      endloop.
      data_package[] = l_t_data_package[].
    But you should first check if aggregates or precalculated web templates are better.
    Best regards
       Dirk

  • Query to show BP year to date sales minus credits

    Hi Experts,
    I would like a query which will show me a single line for each BP:
    BP Code,  Salesperson,  BP Name, Sales Group, Sales YTD (ex vat)
    I want the Sales YTD to be be calculated as total invoiced sales less any credits,  
    Thanks in advance for any help..
    regards
    Geoff

    Hi,
    Check this if it helps :
    select t0.cardcode as 'Business Partner Code' ,t2.slpname as 'Sales Person Name',
    t0.cardname as 'Business Partner Name', t0.GroupCode as 'Sales Group',
    sum(t3.doctotal)- sum(t3.vatsum) as 'YTD Sales',
    sum(t4.doctotal) - sum(t4.vatsum) as 'YTD Credit Memo',
    sum(t5.doctotal) as 'YTD Payments'
    from OCRD t0
    inner join JDT1 t1 on t0.cardcode = t1.shortname
    inner join OSLP t2 on t0.slpcode = t2.slpcode
    left join OINV t3 on t3.objtype = t1.transtype and t3.docdate >= '2011.01.01' and t3.docdate <= '2011.12.31'
    left join ORIN t4 on t4.objtype = t1.transtype and t0.slpcode = t4.slpcode and t4.docdate >= '2011.01.01' and t4.docdate <= '2011.12.31'
    left join ORCT t5 on t5.transid = T1.transid and t5.docdate >= '2011.01.01' and t5.docdate <= '2011.12.31'
    where
    cardtype = 'C' and t1.refdate >= '2011.01.01' and t1.refdate <= '2011.12.31'
    group by t0.cardcode, t2.slpname,t0.cardname,t0.groupcode
    order by t0.cardcode
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Year to date variable

    Hello experts,
    I have installed the variable : Current Year From Start, Range to Current date(Sap Exit) with tech name 0I_IPMD7. How do i know which time infoObject it is applicable to?
    i want to use this in the year to date sales calculation. But cannot see this available in any of the time infoobjects in the present 0sd_c03 cube!!
    please guide..
    regards,

    Hi Aby,
    Please look at RSZGLOBV table. You'll see that this variable is based on 0IPM_BEGDATE characteristic.
    You can also look in SE37 at the FM RSVAREXIT_0I_IPMD7 to figure out what the code is doing.
    Best regards,
    Eugene

  • Getting Turnover Year to Date amount in Sales Order

    Hi Experts
    I would like to be able to have a UDF on Sales Order which shows Sales the Turnover Year to Date for the BP.
    I have created a UDF which is formatted as an amount field and a formatted search with the following syntax.  it is essentially a calculation of the total of all invoices minus credit notes:
    (select (select sum(t1.doctotal) - sum(t1.vatsum) from oinv t1 where (t1.cardcode = t0.cardcode) AND ((T1.[docdate]>='01.01.09') AND (T1.[docdate]<=GETDATE())))
    - (select sum(t2.doctotal) - sum(t2.vatsum) from orin t2 where (t2.cardcode = t0.cardcode)  AND ((T2.[docdate]>='01.01.09') AND (T2.[docdate]<=GETDATE()))))
    from OCRD T0  INNER JOIN OINV T1 ON T0.CardCode = T1.CardCode INNER JOIN ORIN T2 ON T0.CardCode = T2.CardCode
    WHERE T0.[CardCode] = $[$4.1.0]
    it is working for me unfortunately and I hope one of the experts can tell me where I am going wrong?
    Thanks
    Jon

    Hi
    Try this,
    DECLARE @a Numeric(19,6)
    DECLARE @b Numeric(19,6)
    Set @a = Select (SUM(T1.DocTotal) - SUM(T1.VATSUM))
    FROM  OCRD T0
    INNER JOIN OINV T1 ON T0.CardCode = T1.CardCode
    WHERE T0.CardCode = $[$4.0.0]
    AND
    T1.DocDate '01/01/2009' AND T1.DocDate<= 'GETDATE()'
    Set @B = Select SUM(T2.DocTotal) - SUM(T2.VATSUM)
    FROM OCRD T0
    INNER JOIN OINV T1 ON T0.CardCode = T1.CardCode
    INNER JOIN ORIN T2 ON T0.CardCode = T2.CardCode
    WHERE T0.CardCode = $[$4.0.0]
    AND
    T2.DocDate>= '01/01/2009' AND T2.DocDate<= 'GETDATE()'
    SELECT (@a-@b)
    Regards,
    Madhan.

  • CURRENT YEAR SALES DATE PARAMATER AND PRIOR YEAR SAME DATE RANGE

    I am pulling data from a SQL view dbo.view that has current and historical SOP data by line.  The date paramater is a date range,  uppr date and lower date formulas are in the report.  I need to include prior year SOP data for the same prior year date range in the detail.  I have tried adding the view in twice with no luck, just duplications.  Ultimately I want to supress the detail and only show the totals by customer so it is comparitive.  Thanks for your help.  Jayne

    OK
    lets simplify it
    get a test data source with some simple dates in it.
    get the report logic working.
    it looks like you have the right formula ideas but lets go for
    @upperthisyear
    @upperlastyear
    @lowerthisyear
    @lowerlastyear
    then assuming a date field of {table1.date}
    the record selection would be
    if (@upperthisyeare > {table1.date} and @lowerthisyear < {table1.date}) or (@upperlastyeare > {table1.date} and @lowerlastyear < {table1.date}) then 1 else 0
    I would test this by using it as a formula field with the test data.

  • Year to Date and Monthly totals

    I know that this is rather simplistic, but I'm new to Discoverer and need to set up a bunch of sales reports with MTD and YTD columns. I'm going to be using the same SQL query for many of my reports but customizing the reports to show sales by state, product line, etc.
    Is there a formula/function I can use in Discover for the Month to Date and Year to Date totals?
    Thanks,
    Joseph

    Hi Joseph
    You can use the analytic range SUM calculation for these. For the month to date, use the a PARTITION BY of month with a range of all the preceding rows in the partition up to and including the current row. For the year, you would simply change the PARTITION BY to be the year.
    Here are some examples drawn from my own database:
    I have the following items:
    ORDER_YEAR
    ORDER_MONTH
    ORDER_DATE
    SELLING_PRICE
    With these defined, the formula for month to date is:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS UNBOUNDED PRECEDING)
    The formlua for year to date is:
    SUM(Selling Price SUM) OVER(PARTITION BY ORDER_YEAR  ORDER BY  ORDER_DATE ASC  ROWS  UNBOUNDED PRECEDING )
    Basically what we are doing is telling Discoverer to SUM the SELLING_PRICE, and you should be able to take these and adjust them for your own report.
    Let me take a look at the month to end and describe what is going on. Basically the PARTITION BY is defining a set of rows which are to be included. In this case it is all rows that have the same ORDER_MONTH. The ORDER BY clause tells Discoverer to place the items in order, with the oldest order first. The ROWS UNBOUNDED PRECEDING tells Discoverer to SUM all of the items within the set (within the PARTITION BY) from the oldest item (UNBOUNDED PRECEDING) to and including the current item. We could have added a BETWEEN clause too but that is implied. With a BETWEEN clause it would look like this:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    If you want the current row to be included with UNBOUNDED PRECEDING you don't need to explicitly name it because that is the default. Other options you could use are these:
    UNBOUNDED FOLLOWING - this SUMS to the end of the PARTITION
    ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING - you can guess that this will add all of the items, which you will rarely use because if you omit the ROWS command then this range between first and last is actually the default
    Rather than ROWS BETWEEN you can also say RANGE BETWEEN, like this:
    SUM(Sales.Selling Price SUM) OVER (PARTITION BY ORDER_MONTH ORDER BY ORDER_DATE ASC RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    I hope this little dissertation on running totals helps.
    Best wishes
    Michael

  • Return current period based off of current fiscal year and date

    Good Afternoon,
    Is there a way in the webi that I can create a dimension that always reflects the current Fiscal Month based of Fiscal year and date? I have a report that I am trying to show sales for a customer based off the current fiscal month. I would like this report when refreshed to be based off this fiscal month dimension instead of showing each fiscal month or changing it manually. What is the best way to do this?
    I have attached an image that shows current numbers by period (month) and then the YTD Totals. I would like to have my 'Period' column always reflect the current period and the Total column to reflect that months totals based off the period column. So for this period (3), instead of seeing 3 lines for each month I would just see the '3' and the total as $541,310.46, monthly as 412,502.09 and my YTD as 1,080,091.06.
    Any help is always appreciated!
    Thank you,
    Tiffany

    Hi,
    Create a variable
    FlagVar=If([Period]=Max([Period]) In Report;"Show";"Hide")
    And apply block filter of FlagVar=Show
    Are these coming TotalSales  MonthlyGoal YTDSales directly from universe? If they are calculated at report level then you might want to use NoFilter. like =NoFilter([YTDSales])

  • Roll up information for Year To Date

    Hello,
    I have some sales data as follows
    Item_Id Country_Id Region_ID Month_begin_date Quantity Amount
    s1 C1 r1 10/1/2008 20 2000.05
    s2 C1 r1 10/1/2008 100 4350.45
    s3 c2 r2 11/1/2008 50 3200.00
    s3 c1 r3 12/1/2008 102 5102.50
    s3 C2 r2 01/1/2009 35 1989.45
    s2 c1 r1 02/1/2009 56 2989.00
    s3 C3 r3 03/1/2009 29 1129.00
    s1 c3 r3 04/1/2009 455 3000.00
    s2 c2 r2 05/1/2009 123 2345.00
    s3 c2 r1 06/1/2009 40 1878.00
    s1 c2 r2 07/1/2009 65 1123.00
    s2 c2 r2 08/1/2009 100 1000.50
    s3 c3 c3 09/1/2009 191 2500.00
    s1 c2 r3 08/1/2009 299 3448.50
    s2 c3 r3 09/1/2009 432 5000.00
    s3 c1 r3 07/1/2009 175 4000.00
    here item_id,country_id,region_id,month_begin_date are together composite primary key...
    I want to get year to date (sum from the INITIAL date to sysdate) OF sum of quantity and sum of amounts to above data .
    I.E. Query should consider records until 7/1/2009
    and calculates sum of quntity and amount group by primary key fields...
    s1 C1 r1 10/1/2008 20 2000.05
    s2 C1 r1 10/1/2008 100 4350.45
    s3 c2 r2 11/1/2008 50 3200.00
    s3 c1 r3 12/1/2008 102 5102.50
    s3 C2 r2 01/1/2009 35 1989.45
    s2 c1 r1 02/1/2009 56 2989.00
    s3 C3 r3 03/1/2009 29 1129.00
    s1 c3 r3 04/1/2009 455 3000.00
    s2 c2 r2 05/1/2009 123 2345.00
    s3 c2 r1 06/1/2009 40 1878.00
    s1 c2 r2 07/1/2009 65 1123.00
    Thanks in advance...
    please help me out....

    Welcome to Forum!!
    SELECT
    Item_Id, Country_Id, Region_ID, Month_begin_date, SUM(Quantity) , SUM (Amount)
    FROM TABLE_NAME  --Add your table Name
    WHERE Month_begin_date < = SYSDATE  --will Reject records having date > sysdate
                                        --Remember the date comparision is bit tricky
    GROUP BY Item_Id, Country_Id, Region_ID, Month_begin_date1 min :: You want to GROUP the data on the basis of primary key: thats NOT logical
    Edited by: AJ99 on Jul 1, 2009 11:25 AM
    Edited by: AJ99 on Jul 1, 2009 11:29 AM

  • Year to Date reports using Prompts

    Hi.
    I'm trying to build a report that will show results of sales compared to Annual targets. All those fields are fields directly at the opportunity level (amount and targets). I also need to put a prompt to select dates from and to, for the Opportunity Close date. I've used Variables for this, and am comparing throuhg two filters "Opportunity.Close Date greater than pvCloseDateFrom" and "Opportunity.Close Date lower than pvCloseDateTo". I'm also presenting the % Achievment, which is the % of Total Sales compared to the Target field.
    So far the report is simple
    User - Total Amount of Sales - Target FIeld - % Realized.
    The difficulty I'm facing concern the next set of columns in the report : I also need to present the Year to Date Target that is represented by the number of days between the two dates prompted (for instance if I prompt 01/01/2010 and 31/03/2010 needs to show 25% of the total target) along with the % of SAles compared to this new target calculated field.
    I'm having issues with the TIMESTAMPDIFF function through the Presentation Variables as it either tells that the type is not correct even if I'm trying to use the CAST function or it discard part of the string when I'm trying to rebuilt the date as a timestamp : in my configuration date are presented D/M/YYYY where my timestamp function expects DDDD-MM-DD HH-MI-SS.
    Is there anyone who could have an example of such calculations in a report based on dates and duration ?
    Thanks in advance for your help !!
    Olivier

    Dear Adam,
    For Year to Date , We have created a Customer Exit , For working , Create a Variable for 0calday and populate that with from and to value ...to value would be Sy-datum and From value is year starting date. Hope it helps..
    Thanks,
    Krish

  • DAX - Year to Date Calculation

    Hi All,
    We have a requirement of calculating the Year to Date Calculation in DAX for No. of Sales. Below is the table that we are using:
    Year
    Quarter
    Date
    No. of Sales
     If we browse the tabular model with Year/Quarter then formula should calculate the value at quarter levels.
    Formula Definition for Q1 = (Total of “No. of Sales” in current Year upto Q1  / Total of “No. of Sales” in previous Year upto Q1) -1
    Formula Definition for Q2 = (Total of “No. of Sales” in current Year upto Q2  / Total of “No. of Sales” in
    previous Year upto Q2) -1
    Formula Definition for Q3 = (Total of “No. of Sales” in current Year upto Q3  / Total of “No. of Sales” in
    previous Year upto Q3) -1
    Formula Definition for Q4 = (Total of “No. of Sales” in current Year upto Q4  / Total of “No. of Sales” in
    previous Year upto Q4) -1
    Can anybody help us in building this formula in DAX which should be able to browse with any columns of the table.
    Thanks,
    Vishal Jharwade

    Hi Vishal,
    According to your description, we are still not clear about your requirement. Do you want to calculate the "current YTD/previous YTD -1"? Or you want to calculate the Total Year to Quarter for each quarter?
    If you want to calculate the first one, please use the formula below:
    =[Sales](DATESYTD(DimDate[Datekey])) - [Sales](DATEADD(DATESYTD(DimDate[Datekey]),-1,YEAR))
    If you want to calculate the second one, you can use TotalYTD() function to calculate the Year to Quarter value:
    =TOTALYTD(SUM(InternetSales_USD[SalesAmount_USD]),DateTime[DateKey], ALL(‘DateTime’), “3/31”)
    However, since we have to specify a literal string with a date that defines the year-end date, it can't make it dynamically to show the Year to Quarter for the current quarter. So you still can't use only one formula to deal with all quarters.
    Reference:
    First steps in DAX: Year-To-Date
    Time Intelligence Functions in DAX
    Best Regards,
    Simon Hou
    TechNet Community Support

  • SSRS expression for today,yesterday,Lastweek ,Last fortnight,Last Month, Year to date

    Hi All;
    I have a field called createdon 
    Using this field i need to create the SSRS expression for the table as below 
    Any help much appreciated
    Thanks
    Pradnya07

    use expressions as below
    assuming this is to be done in SSRS
    Today
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Yesterday
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    LastWeek
    =COUNT(IIF(
    DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Last fortnight
    =COUNT(IIF(
    (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
    Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
    Last Month
    =COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Year To Date
    =COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
    And
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to fetch year till date value for earning for current ,last and year

    hi,
    how to fetch year till date value for earning for current ,last and year before that from payroll result
    plz reply soon,
    pratyush

    Dear Pratyush,
    Pick this from CRT.
    Use LDB PNPCE & Fire event GET PAYROLL &
    then you can pick from CRT.
    Hope this helps.
    Kindly reward in case useful.
    Regards & Thanks,
    Darshan Mulmule

  • Table for Year to date payments made to vendors

    Hi friends,
    I am generating one query, in which I have to show year to date payments made to vendors.
    can anyone tell me from which table and from which foield can I get this information.
    Please help.

    hi,
    GO to SE16 and select doc type wise , you will get a solution .
    i hope it helps you.
    regds,
    raman

Maybe you are looking for

  • Problem of Query of Module Purchase Order, Good Receipt PO, Good Return

    Hi, I would like to seek for assistance regarding double entries of documents,  I have used the query and found out lately the it has a problem, Please refer to thread "Query of Module Purchase Order, Good Receipt PO, Good Return" for details. You he

  • Iphoto slideshow on a CDR?

    is it possible to put a slideshow i made on iPhoto on a CDR?

  • Can i merge bootcamp partion with mac using parallels

    I installed win 7 via bootcamp, now i installed parallels and using win 7 via my bootcamp (parallels). since i installed parallel can i merge bootcamp partition with macintosh hd, without reinstalling win7 for further use

  • Need help interpreting an RFC Web dynpro exception

    Hi, The following code shows how I set the content of a wdp model: Z_Zmm_Tax_Calc2_Input TaxCode2 = new Z_Zmm_Tax_Calc2_Input(); wdContext.nodeZ_ZMM_TAX_CALC2().bind(TaxCode2); TaxCode2.addItems(new Zzz_Tax_Calc()); It's the last line of the code tha

  • HT2905 Duplicate Songs

    I can't find a way to display duplicate songs in the new version of Itunes.  Any ideas on how to delete duplicates easier than going through 1 by 1?