Reg : Curr Month,Previous Month,Curr Month Previous Year

Hi all ,
             I have a req where I have to display the sales for
Current Month               Sales value
Previous Month             Sales value
    Curr Month                Sales 
Previous Year
Curr Month and Previous Month I got it with Time Series AGO Function .
But current month for the Previous Year , I am not able to proceed .
Kindly help.
Reg,
Niv D

Hi NIV,
You can use the same time series function to calculate current month of last year values.
Ago (measure column , year , 1)
it describes the last year sales of current month
OBIEE -Time Series in OBIEE
Regards,
VG

Similar Messages

  • Variance of Wagetype amounts  Report  for the previous and prest months

    Hi experts,
    our clients are wish to have the report of  Variance of Wagetypes for the Previous and Present months.
    we require the report on  new wagetypes included in the Current month along with amount and also any wagetypes deleted for the current month along with amount.We also need to have the Difference between previous gross amount and current months Gross.
    Is it possible to have the report on variation of amounts.
    Regards,
    V Sai.

    Hi,
    The quickest way is to use wage type reporter (transaction PC00_M99_CWTR, report H99CWTR0_CE).
    There you can specify two payroll periods and compare values by wage types, if necessary export result in Excel and do whatever you want.
    Cheers

  • Month name displayed in month calendar view for previous month

    In iPad IOS 7.04 iCal month view the month name displayed at the top of the window is incorrect. The previous month name show when viewing a calendar month. Test by selecting year view and the any month from the year. The month view will be for the selected month, but the month name will be for the preceding month. The incorrect month name in month vie is also displayed if the month view is scrolled to new months.
    I observe this on my iPad II.
    Ha s anyone seen this error? Does anyone know if Apple has seen this and has a plan to correct it?

    Imhave the same exact problem on my iPad2.  It was not fixed in the recent iOS 7.1 release, even though modifications were made to the calendar app.  Very frustrating, since this is such an easily observable problem.

  • SQL Query to add previous month amount to current month amount

    Beginner - Using SQL 2008 R2 - Having a difficult time adding previous month amount to current month amount on a continual running basis. Table fields and example data are:
    FunctionID    
    UnitID     
    Dateof           
    Result       YTD
    A                   AA           01/01/2014    10             10
    A                   AA           02/01/2014    10            
    20
    A                   AA           03/01/2014     15           
    35
    B                  BB            01/01/2014     20          
    20
    B                  BB            02/01/2014     10           30
    The YTD field would be a calculated field. I would need to be able start a new YTD in Jan of the next year. Really could use some help and direction on this one. Easy to do in an Excel spreadsheet. Can't seem to get it in SQL. Thanks in advance.

    As of 2008 R2 the choices are:
    - Self join
    - Correlated subquery (in the SELECT or APPLY clauses)
    - Cursor
    - SQLCLR aggregation function (winner)
    The first two options yield a poor performance for tables with considerable number of rows.
    Example:
    select
        A.*, 
        select
            sum(B.Result)
        from
            T as B
        where
            B.FunctionID = A.FunctionID
            and B.UnitID = A.UnitID
            and B.Dateof >= dateadd(year, datediff(year, '19000101', A.Dateof), '19000101') --bofyear
            and B.Dateof <= A.Dateof
        ) as YTD
    from
        T as A;
    Check these old but very interesting posts from Adam Machanic.
    http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/running-sums-redux.aspx
    http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/running-sums-yet-again-sqlclr-saves-the-day.aspx
    The things get easier from SS 2012 with the enhanced OVER clause (introduction of window frame extent).
    select
        sum(Result) over(
        partition by FunctionID, UnitID, year(Dateof) 
        order by Dateof
        rows between unbounded preceding and current row
        ) as YTD
    from
        T;
    http://sqlmag.com/sql-server-2012/sql-server-2012-how-write-t-sql-window-functions-part-3
    AMB
    Some guidelines for posting questions...
    AYÚDANOS A AYUDARTE, guía básica de consejos para formular preguntas

  • Date Functions( first day of a month that is 3 months from now....)

    I have recently written my first stored procedure.
    Its rather a bunch of SQL statements.
    I had to hard code lot of dates. most of them are first day of the current monthe or last day of current month etc.
    I thot of parametrizing all the dates, but if a business person has to include all the parameters they could go wrong and get the wrong results.
    Now, I want to use date functions to achieve these requirements:
    Can any one please throw some insght into this:....
    1) First day of current month,
    2) last day of current month.
    3) first day of previious month
    4) last day of previous month
    5) first day of a month that is 3 months from now.
    6) last day of a month that is 3 months from now.
    7).....
    Can any one please throw some light on any one of this.. I can try to work from there onwards ....
    Thanks a lot in advance,
    Ac

    Hi there,
    1) First day of current month
    select trunc(sysdate, 'MM') from dual;
    2) last day of current month.
    select trunc(add_months(sysdate, 1), 'MM') - 1 from dual;
    3) first day of previious month
    select trunc(add_months(sysdate, -1), 'MM') from dual;
    4) last day of previous month
    select trunc(sysdate, 'MM') - 1 from dual;
    5) first day of a month that is 3 months from now.
    select trunc(add_months(sysdate, 3), 'MM') from dual;
    6) last day of a month that is 3 months from now.
    select trunc(add_months(sysdate, 4), 'MM') - 1 from dual;cheers,
    Anthony

  • How to take last months date to current month date

    Hi,
    I am designing a report wherein the data should range from 12:01am on the 28th day of the previous month to 11:59 pm on the 27th of the current month..  Also this report would be scheduled accordingly and I should  not be able to modify the report every month.  What is the formula that should go into it.
    Any help will be greatly appreciated!
    Thanks & Regards
    Cauvery

    Hi Cauvery,
    try to use the following formula :
    Local DateTimeVar A;
    Local DateTimeVar From_;
    Local DateTimeVar To__;
    A:=today;
    if Month(A)=1
    then From_:=Datetime(year(A),12,28,0,1,0)
    else From_:=Datetime(year(A),Month(A)-1,28,0,1,0);
    To__:=Datetime(year(A),Month(A),27,23,59,0);
    Regards
    Edited by: jeecech on Apr 17, 2009 9:37 AM

  • Displaying current month with all empty months

    None of the answers I've seen for showing current month in a calendar has given a solid answer. So, here is my question. My objective is to display all calendar months rather they are empty or not, plus I want the calendar to start at the current month. I added coding to display a next month and previous month button, so you should be able to click next or previous month from the current month showing. I have the "Show All Empty Months" checked in the Display Options under Common Options and the start and end date are empty. I have a bind variable in my coding that defaults to the current month but it will not show an empty month. I get the "no rows returned" situation because it doesn't have anything in it. Is there a solution to showing all empty months?
    Also, has anyone found a solution to hide/remove the default Next/Previous buttons? I read in one of the replies that this would be fixed in a forthcoming release. Is this true?
    Thanks for any assistance.

    The calendar works on a sql query result. I had done something similar to what you are looking for by spoofing the sql query to return rows for all the months which I am interested in. I had a query like the following.
    select *
    from scott.emp a , ( select (trunc(sysdate) - 7910 + rownum) dat from user_objects ) b
    where b.dat = a.hiredate (+)
    Hope you can do something similar to this.

  • How to calculate the number of days until your next birthday. Only using current month, day and birth month and day.

    I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
    Attachments:
    D5.7_1.vi ‏8 KB

    I just had a little fun with the Time Record...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    D5.7_1_BD.png ‏19 KB

  • Need a formula for 12 months data, 6 months data and 3 month

    Hi All Crystal Experts,
    In my report, data is grouped by months and I have monthly view of data. I have three prompts- Year, Startdate and Enddate. If I give 2013 as year, 1/1/2013 as start date and 05/01/2013 as end date then report shows monthly view of data for Jan-13, feb-13, Mar13, Apr-13 and May-13. Now in report, for each month, I want three additional columns, I want to show last 12month, 6 month and 3 months view. Like for Jan-13 month, in column 6 months, I want to show data for last 5 months including current month i.e. Jan-13+Dec-12+Nov-12+Oct-12+Sep-12+Aug-12 and in Column 12months view, I want to show accumulated data of last 11 months(+ current month) and in 3 months view, data for last 2 months(+ current month).
    I had tried creating Sub report for 12 months view and created Running total formula  but it is not showing any value in report. It is blank. I have created running total like this way:
    (1) "Running total formula" (which I am using and placing on group footer):
    (I) Field to summarize- @Cash_total
    (ii) Evaluate (use a formula):
    WhilePrintingRecords;
    NumberVar Cash_total_12 months;
    If Month ({@Month_PostDate}) In [(Month {?StartPostDate} - 11) to Month
    {?StartPostDate}] Then
       Cash_total_12 months :=  Cash_total_12 months + {@Cash_Total};
    (iii) Reset (use a formula):
    WhilePrintingRecords;
    NumberVar Cash_total_12 months=0;
    When I placed this formula in group footer, it is showing nothing.
    Please suggest me formula. Quick help would be much appreciated.
    Thanks,

    Hi Remi,
    Please do not post multiple threads for the same issue.
    Continue discussion on this thread:
    How to calculate last 12 months, 6 months, 3 months data in report
    -Abhilash

  • Does anyone know of an iPad app that can lock the iPad after a period of months (i.e., 6 months)?

    Does anyone know of an iPad app that can lock the iPad after a period of months (i.e., 6 months)? I am looking to give ipads to contestant participants and need a way to automatically lock the device once the set duration (measured in days, weeks, months or years) is complete. Does anyone know of an iPad app that locks the device after a period longer than 24 hours (ike most parental control apps)??
    Thanks for any help!!

    It's called "SelfControl". It can be a little hard to learn to use but it's worth the effort.

  • $300 /month for 4 conecutive months in BEx Query Designer

    Hello.
    Iu2019ve a business requirement to monitor customer spending habit.
    The report should display all customers who have spent more then $300 per month for 4 months consecutively.
    Please help
    Thanks in advance

    Hi Khaja,
    Thanks for your quick response.
    I've Customer and Calendar Year/Month in Rows and Amount in column. Created a condition for Amount > $300.
    What I want is; whenever user runs the report; the report should show only those customers who have spend more then $300 per month for last 4 months consecutively.
    My report would display:
    Customer No.   Calendar Year/Month    Amount
    What do you mean by RKF's and how would I create these?
    Thanks

  • Hello, I have Acrobat XI Pro for which I pay by monthly subscription. Each month, for the past three months or so, at renewal time, I receive a note stating that my trial period has expired and I cannot open my Acrobat Files. I have telephoned three or fo

    Hello, I have Acrobat XI Pro for which I pay by monthly subscription. Each month, for the past three months or so, at renewal time, I receive a note stating that my trial period has expired and I cannot open my Acrobat Files. I have telephoned three or four times each time this happens and have been told that the matter has been resolved - it has not! At one time I had paid inadvertently for three account for Acrobat XI Pro running at the same time - I only need 1. I'm afraid that I may have just opened a second account by mistake in order to open my files. I repeat, I only require one account. Would you please advise and assure me that this matter has finally been resolved and that I will no longer receive these notifications each month..

    I don't work for Adobe but it seems to me you might be signing in to Acrobat with the wrong Adobe ID.
    Check the Adobe ID you use in Acrobat.
    Check this Adobe ID on Adobe's to make sure that it has an active subscription.

  • Monthly subscription for three months

    Hi
    I bought a suscription for three month on may 14,2015 and skype says next payment on june 18, 2015. Why???
    Can anyone explain to me please
    thanks

    kamullick wrote:
    Suppose I buy a Monthly subscription for three months of 120 minutes each and run out of minutes in the middle of the first month. If I want to buy an extra monthly subscription in the middle of the first month what should I do?
    Hello and welcome to the Skype Community!
    In that case you should purchase another Subscription but with a different amount of monthly minutes. You can't have two identical Subscriptions running at the same time on the same account.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Last/latest 10 months data ( including current month)

    Hi,  
    I need to find the last/latest 10 months data ( including current month)
    Year
    1/1/2014
    1/2/2014
    1/3/2014
    1/4/2014
    1/5/2014
    1/6/2014
    1/7/2014
    1/8/2014
    1/9/2014
    1/10/2014
    1/11/2014
    1/12/2014
    1/1/2013
    1/2/2013
    1/3/2012
    1/4/2012

    Hi,
    this is my data 
    Year column with Nvarchar datatype. 
    Year
    1/1/2014
    1/2/2014
    1/3/2014
    1/4/2014
    1/5/2014
    1/6/2014
    1/7/2014
    1/8/2014
    1/9/2014
    1/10/2014
    1/11/2014
    1/12/2014
    1/1/2013
    1/2/2013
    1/3/2012
    1/4/2012
    now form this yea) column i need to fetch the latest/last 10 months data only .
    OutpUt for the Query to be:
    Year
    1/3/2014
    1/4/2014
    1/5/2014
    1/6/2014
    1/7/2014
    1/8/2014
    1/9/2014
    1/10/2014
    1/11/2014
    1/12/2014
    Hope this will give you clear picture

  • Generic FG/class for spreading non-monthly qty's into monthly buckets

    In custom long-term planning reports, we may have to use data like labor hours that are stored in non-monthly buckets, e.g. buckets like
    12/15/2010 u2013 1/14/2011  100 hours
    1/15/2011 u2013 2/14/2011       80 hours
    etc.
    But in order to make our long-term reports useful for cash-flow estimation/planning, we may have to reslot such non-monthly data into fiscal monthly buckets like:
    Dec 2010
    Jan 2011
    Feb 2011
    In the above simple example, the translation from non-monthly data to monthly data is simple:
    half of the hours from the 12/15/2010-1/14/2011 non-monthly bucket go into the Dec 2010 monthly bucket and
    half of the hours from the 12/15/2010-1/14/2001 non-monthly bucket go into the Jan 2011 monthly bucket.
    etc.
    And generalizing from this simple example, you can see that there will always be some ratio in which the non-monthly data can be split into monthly data.  (For example, the ratio between a non-monthly bucket and two successive monthly buckets might be 3:1 if 3 weeks of the non-monthly bucket fall into the first monthly bucket and the fourth week of the non-monthly bucket falls into the second monthly bucket.
    These considerations suggest that SAP developers and customers might benefit from a generic FG or class that:
    accepted a set of non-monthly buckets plus a set of quantities 
    figured out the monthly buckets spanning this set of non-monthly buckets
    spread the non-monthly data into the monthly buckets correctly (according to the simple u201Cratiou201D idea outlined above.)
    This generic FG or class would do (1-3) regardless of the specific nature of the quantities involved ... because who cares what they are.  Also, one could imagine a version of this class or FG where the output buckets might not be monthly, but rather a different set of non-monthly buckets than the input non-monthly buckets.
    So, my four questions are:
    Does anyone know of an SAP-delivered class or FG that does (1-3)  (Iu2019m thinking SCM/APO might well have one u2026)
    If not, does anyone have anything approaching this class of FG that they would care to share with me (via email, of course)?
    If not, does any genius out there have the time to write such a class and put it in the SDN code base?
    Do you all agree that the safest way to get the ratio is to take everything to the u201Clowest common denominatoru201D of days and then figure the ratio accordingly?
    Thanks for considering this matter.
    djh

    As you can see from below, the code markers aren't working in Mozilla either ....oh well
    FUNCTION ZCK_TRAN_TO_MONTHS.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(START_DATE) TYPE  FSTAD
    *"     REFERENCE(END_DATE) TYPE  FENDD
    *"     REFERENCE(AMOUNT) TYPE  ZZVGWRT
    *"  TABLES
    *"      MONTH_TABLE_FOR_RUN TYPE  ZMMY_MSTR_DATA_EST_YRMO
    *"  CHANGING
    *"     REFERENCE(MONTH_BUCKETS) TYPE  ZMMS_MSTR_DATA_EST_MOBUCKETS
    FIELD-SYMBOLS:
      <fs_mobu>             TYPE zmms_mstr_data_est_mobuckets,
      <fs_mota>             TYPE zmms_mstr_data_est_yrmo,
      <fs_buck>             TYPE zzvgwrt.                        "bucket of month_buckets
    DATA:
      lv_month(2)           TYPE n,
      lv_year(4)            TYPE n,
      lv_m_days             TYPE i,
      lv_total_days         TYPE i,
      lv_last_day           LIKE sy-datum,
      lv_out_flag           TYPE c,
      ls_month_buckets      TYPE zmms_mstr_data_est_mobuckets,
      lv_yrmo               TYPE zzbkper,
      lv_index1             LIKE sy-tabix,
      lv_index2             LIKE sy-tabix,
      lt_month_table        TYPE zmmy_mstr_data_est_yrmo.
      lt_month_table[] = month_table_for_run[].
      lv_total_days    = end_date - start_date.
      lv_month         = start_date+4(2).
      lv_year          = start_date(4).
      CLEAR:             lv_out_flag,
                         gt_mo_spread,
                         ls_month_buckets.
      DO.
        IF lv_month = start_date+4(2) AND lv_year = start_date(4).
          CALL FUNCTION 'MM_LAST_DAY_OF_MONTHS'
            EXPORTING
              day_in            = start_date
            IMPORTING
              last_day_of_month = lv_last_day
            EXCEPTIONS
              day_in_no_date    = 1
              OTHERS            = 2.
          lv_m_days = lv_last_day - start_date.
        ELSEIF lv_month = end_date+4(2) AND lv_year = end_date(4).
          lv_m_days = end_date+6.
          MOVE 'X' TO lv_out_flag.
        ELSE.
          CONCATENATE lv_year lv_month '01' INTO lv_last_day.
          CALL FUNCTION 'MM_LAST_DAY_OF_MONTHS'
            EXPORTING
              day_in            = start_date
            IMPORTING
              last_day_of_month = lv_last_day
            EXCEPTIONS
              day_in_no_date    = 1
              OTHERS            = 2.
          lv_m_days = lv_last_day+6.
        ENDIF.
        APPEND INITIAL LINE TO gt_mo_spread ASSIGNING <fs_mosp>.
        <fs_mosp>-year   = lv_year.
        <fs_mosp>-month  = lv_month.
        <fs_mosp>-amount = amount / lv_total_days * lv_m_days.
        IF lv_month EQ 12.
          ADD 1 TO lv_year.
          CLEAR lv_month.
        ENDIF.
        ADD 1 TO lv_month.
        IF lv_out_flag EQ 'X'.
          EXIT.
        ENDIF.
      ENDDO.
    * now:
    *   loop thru gt_mo_spread
    *   pick up month_bucket index from month_table_for_run
    *   add amount from gt_mo_spread row to appropriate month_bucket
      ASSIGN ls_month_buckets TO <fs_mobu>.
      LOOP AT gt_mo_spread ASSIGNING <fs_mosp>.
        lv_index1 = sy-tabix.                          "just in case we need it
        CONCATENATE <fs_mosp>-year
                    <fs_mosp>-month
               INTO lv_yrmo.
        READ TABLE lt_month_table ASSIGNING <fs_mota>
          WITH KEY
            zzyrmo = lv_yrmo.
        lv_index2  = sy-tabix.
        ASSIGN COMPONENT lv_index2 OF STRUCTURE <fs_mobu> TO <fs_buck>.
        <fs_buck> = <fs_buck> + <fs_mosp>-amount.
      ENDLOOP.
      month_buckets = ls_month_buckets.
    ENDFUNCTION.
    FORM build_bucketed_detail.
    FIELD-SYMBOLS:
      <fs_mobu>                         TYPE zmms_mstr_data_est_mobuckets,
      <fs_comp1>                        TYPE zzvgwrt,  "bucket in ls_mo_buckets/<fs_mobu>
      <fs_comp2>                        TYPE zzvgwrt,
      <fs_mota>                         TYPE zmms_mstr_data_est_yrmo,
      <fs_buck>                         TYPE zzvgwrt.            "bucket of month_buckets
    DATA:
      lv_matnr_arbid_cur(26)            TYPE c,
      lv_matnr_arbid_lag(26)            TYPE c,
      lv_dtlh_index                     LIKE sy-tabix,
      ls_month_buckets                  TYPE zmms_mstr_data_est_mobuckets,
      lv_nummo                          TYPE i,
      lv_yrmo                           TYPE zzbkper,
      lv_yindx                          TYPE i,
      lv_bindx1                         LIKE sy-tabix,     "index on ls_month_buckets cmpnts
      lv_bindx2                         LIKE sy-tabix.     "index on <fs_dtlhmo> buckets
                                                           "note: must be lv_bindx1 + 5.
      lv_nummo = LINES( gt_mo_tbl ).
      READ TABLE gt_dtlh_keys INDEX 1 ASSIGNING <fs_dtlh>.
        CONCATENATE <fs_dtlh>-matnr
                    <fs_dtlh>-arbid
               INTO lv_matnr_arbid_lag.
      lv_dtlh_index = 1.
      APPEND INITIAL LINE TO gt_dtlhmo_keys ASSIGNING <fs_dtlhmo>.
      <fs_dtlhmo>-matnr      = <fs_dtlh>-matnr.
      <fs_dtlhmo>-arbid      = <fs_dtlh>-arbid.
      <fs_dtlhmo>-arbpl      = <fs_dtlh>-arbpl.
      <fs_dtlhmo>-kostl      = <fs_dtlh>-kostl.
      ASSIGN ls_month_buckets TO <fs_mobu>.
      DO.
        READ TABLE gt_dtlh_keys INDEX lv_dtlh_index ASSIGNING <fs_dtlh>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        CONCATENATE <fs_dtlh>-matnr
                    <fs_dtlh>-arbid
               INTO lv_matnr_arbid_cur.
        IF lv_matnr_arbid_lag <> lv_matnr_arbid_cur.
          CLEAR <fs_dtlhmo>.
          APPEND INITIAL LINE TO gt_dtlhmo_keys ASSIGNING <fs_dtlhmo>.
          <fs_dtlhmo>-matnr        = <fs_dtlh>-matnr.
          <fs_dtlhmo>-arbid        = <fs_dtlh>-arbid.
          <fs_dtlhmo>-arbpl        = <fs_dtlh>-arbpl.
          <fs_dtlhmo>-kostl        = <fs_dtlh>-kostl.
          CLEAR ls_month_buckets.
          CLEAR <fs_mobu>.
        ENDIF.
        <fs_dtlhmo>-tot_vgw01_03   = <fs_dtlh>-vgw01 +
                                     <fs_dtlh>-vgw02 +
                                     <fs_dtlh>-vgw03.
        IF <fs_dtlh>-fstad+4(02) = <fs_dtlh>-fendd+4(02).
          lv_yrmo = <fs_dtlh>-fstad+0(6).
          READ TABLE gt_mo_tbl ASSIGNING <fs_mota>
            WITH KEY
              zzyrmo = lv_yrmo.
          lv_yindx  = sy-tabix.                                "month number
          lv_yindx  = lv_yindx  + 5.                           "to account for leading fields
          ASSIGN COMPONENT lv_yindx
              OF STRUCTURE <fs_dtlhmo>
                        TO <fs_buck>.
          <fs_buck> = <fs_buck> + <fs_dtlh>-tot_vgw01_03.
        ELSE.
          CALL FUNCTION 'ZCK_TRAN_TO_MONTHS'
            EXPORTING
              START_DATE             = <fs_dtlh>-fstad
              END_DATE               = <fs_dtlh>-fendd
              AMOUNT                 = <fs_dtlhmo>-tot_vgw01_03
            TABLES
              MONTH_TABLE_FOR_RUN    = gt_mo_tbl
            CHANGING
              MONTH_BUCKETS          = ls_month_buckets.
          lv_bindx1 = 1.
          DO.
            IF lv_bindx1 > lv_nummo.
              EXIT.
            ENDIF.
            lv_bindx2 = lv_bindx1 + 5.
            ASSIGN COMPONENT lv_bindx1 OF STRUCTURE <fs_mobu>   TO <fs_comp1>.
            ASSIGN COMPONENT lv_bindx2 OF STRUCTURE <fs_dtlhmo> TO <fs_comp2>.
            <fs_comp2> = <fs_comp2> + <fs_comp1>.
            lv_bindx1 = lv_bindx1 + 1.
          ENDDO.
        ENDIF.
        lv_dtlh_index = lv_dtlh_index + 1.
      ENDDO.
    ENDFORM.
    Edited by: David Halitsky on Sep 9, 2010 9:42 PM

  • Query item not sold per customer for this month compare with last month

    Dear all,
    i want to make query that show information about item sold per customer last month which is not sell again this month.
    for example last month customer A buy item 1,2 and 3. This month, customer A only buy item 2. So, the query will show information item 1 and 3 which is not sell again to customer A.
    Thanks a lot

    Here's one that will show you items bought in the last 60 days but not the last 30 days.  It's not perfect but will get you on your way, some bits will also not be relevant, like the qrygroup64 part.
    select     t0.cardcode,
              t0.cardname,
              t2.slpname,
              t1.itemcode,
              t1.itemname,
              t1.onhand,
              s0.[2mthqty],
              s0.[2mthdollar],
              s1.[1mthqty],
              s1.[1mthdollar],
              s2.lastsale
    from
    (select     t0.cardcode,
              t1.itemcode,
              sum(t1.quantity) as [2mthqty],
              sum(t1.linetotal) as [2mthdollar]
    from
    oinv t0
    inner join
    inv1 t1
    on t0.docentry = t1.docentry
    where t0.docdate >= getdate()-60
    and t1.quantity > 0
    group by     t0.cardcode,
                   t1.itemcode) s0
    full outer join
    (select     t0.cardcode,
              t1.itemcode,
              sum(t1.quantity) as [1mthqty],
              sum(t1.linetotal) as [1mthdollar]
    from
    oinv t0
    inner join
    inv1 t1
    on t0.docentry = t1.docentry
    where t0.docdate >= getdate()-30
    group by     t0.cardcode,
                   t1.itemcode) s1
    on s0.cardcode = s1.cardcode and s0.itemcode = s1.itemcode
    inner join
    (select     t0.cardcode,
              t1.itemcode,
              max(t0.docdate) as lastsale
    from
    oinv t0
    inner join
    inv1 t1
    on t0.docentry = t1.docentry
    where t0.docdate >= getdate()-60
    group by     t0.cardcode,
                   t1.itemcode) s2
    on s0.cardcode = s2.cardcode and s0.itemcode = s2.itemcode
    inner join
    ocrd t0
    on s0.cardcode = t0.cardcode
    inner join
    oitm t1
    on s0.itemcode = t1.itemcode
    inner join
    oslp t2
    on t0.slpcode = t2.slpcode
    where           (s1.[1mthqty] = 0 or s1.[1mthqty] is null)
    and t0.qrygroup64 = 'N'

Maybe you are looking for