Past 12 months Average!

Hello BW Gurus,
Can any one help me in getting past 12 months average? Do we need to write any code? Currently I am using formula key figure (period1) and text variable (zperiod1)in the Bex to calculate the past 12 months average but for some reason it is giving the wrong values.
I am calculating as follows:
period1 = current month-13;current month-1
zperiod = period1/12
period1 is not giving me the total range value of last 12 months and it is just picking the current month and dividing it by 12. Is there any work around to get this done?
Thanks in Advance,
Liza.

Hi,
Following is the code for VAR2 (current month-1), which I could find off the shelf:
    WHEN 'VAR2'.
      IF I_STEP = 1.
      DATA: L_MONTHC TYPE C LENGTH 2,
                L_DATEC TYPE C LENGTH 2.
        L_MONTHC = SY-DATUM+4(2).
        L_DATEC = SY-DATUM+6(2).
            IF L_MONTHC > 1.
              L_MONTHC = L_MONTHC - 1.
              L_YEAR2 = SY-DATUM(4).
            ELSE.
              L_MONTHC = 12.
              L_YEAR2 = SY-DATUM(4) - 1.
            ENDIF.
        IF STRLEN( L_MONTHC ) < 2.
          CONCATENATE '0' L_MONTHC INTO L_MONTHC.
        ENDIF.
        CONCATENATE L_YEAR2 L_MONTHC INTO L_S_RANGE-LOW.
        L_S_RANGE-OPT = 'EQ'.
        L_S_RANGE-SIGN = 'I'.
        APPEND L_S_RANGE TO E_T_RANGE.
      ENDIF.
You could modify the code slightly to get VAR1.

Similar Messages

  • I want to create a formula in numbers that gives me an ongoing monthly average

    I've created a spreadsheet to track my MPG, and I'm also logging all maintenance bills too.
    What I want to do, is get an idea of how much the vehicle is costing me on a monthly average. I want this to be ongoing over several years and therefore want the spreadsheet to work out the monthly average cost over the life of the vehicle.
    How would I write a formula to do this without having to manually adjust the formula each month?

    Ahhh.  OK.  you want to see an average that is only for one months data out of a list of entries,
    E2=EOMONTH(A2, 0)
    this is shorthand for... select cell E2, then type (or copy and paste from here) the formula:
    =EOMONTH(A2, 0)
    F2=EDATE(EOMONTH(A2,0)+"1d", −1)
    D2=IF(MONTH(A2)≠MONTH(A3), AVERAGEIFS(C,A,"<="&E2, A, ">="&F2), "")
    select cells D2 the F2, copy
    select cells D2 thru F8, paste
    once you are done you can combine the formulas for columns E and F into column D.... or... you can hide columns E and F

  • Issue with Past Month data in the Select Statement

    Hi,
    I written the following query,
    SELECT   /*+NO_MERGE(A)*/
                CASE
                   WHEN snap_shot_date > a.q3
                   AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char              
                END snap_shot_date,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END sort_by,
                pillar3_exposure_class_code, pd_band_description,
                ROUND (SUM (p3.ead_post_sec_post_crm)),
                ROUND (SUM (notional_principle)),
                DECODE (SUM (notional_principle),
                        0, 0,
                        ROUND (  SUM (DECODE (exposure_type,
                                              'UNDRAW', ead_post_sec_post_crm,
                                              0
                               / SUM (notional_principle),
                               4
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (pd_value * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (SUM (rwa) / SUM (p3.ead_post_sec_post_crm), 4)
                DECODE (SUM (p3.ead_post_sec_post_crm),
                        0, 0,
                        ROUND (  SUM (lgd_rate * p3.ead_post_sec_post_crm)
                               / SUM (p3.ead_post_sec_post_crm),
                               2
                TO_CHAR (MAX (a.max_date), 'FMMonth DD, YYYY')
           FROM summary.pillar3 p3,
                (SELECT DISTINCT (month_end_date) max_date,
                                 LAST_DAY (month_end_date) q4,
                                 TO_CHAR (LAST_DAY (month_end_date),
                                          'MON YYYY'
                                         ) q4char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -3) q3,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -3),
                                     'MON YYYY'
                                    ) q3char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -6) q2,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -6),
                                     'MON YYYY'
                                    ) q2char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -9) q1,
                                 TO_CHAR
                                    (ADD_MONTHS (LAST_DAY (month_end_date), -9),
                                     'MON YYYY'
                                    ) q1char,
                                 ADD_MONTHS (LAST_DAY (month_end_date), -12) q0
                            FROM rcdwstg.stg_bcar_detail) a
          WHERE snap_shot_date BETWEEN ADD_MONTHS (a.max_date, -12) AND a.max_date
       GROUP BY CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN q4char
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN q3char
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN q2char
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN q1char
                END,
                CASE
                   WHEN snap_shot_date > a.q3 AND snap_shot_date <= a.q4
                      THEN 1
                   WHEN snap_shot_date > a.q2 AND snap_shot_date <= a.q3
                      THEN 2
                   WHEN snap_shot_date > a.q1 AND snap_shot_date <= a.q2
                      THEN 3
                   WHEN snap_shot_date > a.q0 AND snap_shot_date <= a.q1
                      THEN 4
                END,
                pillar3_exposure_class_code,
                pd_band_description
       ORDER BY 2 DESC;I have written the query to get the latest 12 months data from a table and split that into 4 quarter to show in the Cognos Report. But when the table having 13th or the past months data, the select statement is showing Empty values in the first two columns and fetching the 13 month data too.
    Can anyone help me in this to avoid the problem.
    Thanks
    Radha K

    WHERE snap_shot_date BETWEEN ADD_MONTHS(TRUNC(a.max_date, 'MM'), -11) AND  a.max_date
    ....

  • Variable (Perhaps replacement Path) to group past months together

    Hello.
    I'm trying to perform a query that would group past months data within the current month to aggregate my Key Figures.
    As an example, I have in my InfoCube:
    - Material
    - CalendarMonth
    - Initial Qty (Key Figure)
    - Added Qty (Key Figure)
    - Substracted Qty (Key Figure)
    I'd like to get something like my materials on rows, CalendarMonth on column with my 3 Key Figures on rows as well.  The only thing is that all data pertaining to months prior to "Right now (i.e. August 08)" should be aggregated in August 08, therefore, my first month of data displayed would be August and not January 08 if I have data in this month. 
    This might be very basic to you experts out there but I'm pretty new to the nice BW world and can't figure how to do it.  Any help would be appreciated.
    Thank you.
    P.s. I can't find anywhere (except for the small hints on the right when posting a new thread) how I can format my post as I'd like to put TABS and space but they're getting removed in the preview, is there anywhere the list of ALL possible codes I can use when posting ?

                                August 08     September 08     October 08     November 08     December 08     January 09     February 09     March 09
    MATERIAL-1     Initial Qty        20,000                                   
                   Added Qty                            5,000                         8,000         2,000         2,500                         3,000
                 Subst. Qty                          2,000         6,500                     15,000         2,800         6,400       5,000
                 Total                20,000         23,000        16,500        24,500        11,500        11,200         4,800       2,800
    MATERIAL-2     Initial Qty             u2026             u2026            u2026         u2026                   u2026                    u2026            u2026           u2026
                 Added Qty             u2026                 u2026            u2026         u2026                   u2026                    u2026            u2026           u2026
                      Subst. Qty             u2026             u2026            u2026         u2026                   u2026                    u2026               u2026           u2026
                 Total                     u2026             u2026            u2026         u2026                   u2026                    u2026               u2026           u2026
    Ok, I've finally been able to manage a "similar" output to what I'm trying to achieve.  The total line would actually be a calculated key figure based on the three others.  So in the example above, user as specified March 2009 to be the end calendar period he wants to see the inventory "estimates".  All data prior August 2008 should be shown in August 2008 in their respective Key Figures and then the "Total" would adjust accordingly.  So to answer your question, yes, the same logic need to apply to all 3 Key Figures.

  • I have the latest version of Abode Reader. However, over the past month or so, my Reader has constan

    I have the latest version of Adobe Acrobat Reader. I operate on Windows 7 with Outlook as my e-mail filter. However, over the past month or so, my Reader has constantly become "not responding" whenever I open-up a pdf file that was attached to an e-mail. When trying to read the pdf file, it doesn't allow me to scroll through the document and then goes into "not responding" mode which forces me to exist and then re-open the file many times until I have been able to read the documents. This "not responding" shut down to the pdf file is constant and very annoying. What is going on and how can I fix it?
         THanks,

    Thank you for your kind and thoughtful input.
    My Adobe reader is the most current one that's out there per Adobe.
    Something like XII  or higher.
    As for my Outlook, it's MS Outlook 2003, and I believe it's Express Outlook.
    If I disable the Protected Mode, per your suggestion, maybe that will work.
    I'll try it.
    Thanks again, and if you have any other ideas, I would appreciate your
    thoughts.
    Thank you.
    Joel

  • Need to delete the requirements in md61 screen for the past month

    Hi Gurus,
    I am having one requirment that my client need to auto delete the md61 screen entries , Suppose the requirement is maintained for 1000 the planned order will also generated for 1000 qty if stock is not available , then the production is done only for 500 quantities. On the next MRP run the system is considering again the past month 1000 quantities .
    How we can restrict this? If suppose the balace 500 quantities also the user dont want to produce . Then how can we delete automatically .
    Pl help me out this.

    Hello Vishnu,
    You can delete the old PIRs when the new month begins through batch job for MD74/MD75/MD76.
    Other way is to define a period of adjustment for the MRP Group in transaction OMPG and assign the MRP group to your material. Please refer F1 help there
    Adjusting in the past, that is the period of adjustment is calculated backwards - the system starts from today's date and calculates backwards by the number of days specified. Thus, planned independent requirements that lie before the date calculated by the system are not included in the planning run.
    Please refer
    MD61 considering Past requirements
    Best Regards,
    R.Brahmankar

  • I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    I have been dragging my files to a external drive to have a back-up for them and I lost some of my folders. They just went completely missing. I didn't delete them, and it was all stuff that I have worked on in the past month. How do I get them back?

    You really should be doing backups with an actual backup application, especially one that will work automatically, and, if your external HD is large enough, back up your entire system.  These can automatically back up only what's changed since the  previous backup, and some will keep "archive" copies of things you've changed or deleted, also.
    Too many things can go wrong, such as your internal HD failing, and you'll have a major project to reinstall everything.
    You already have Time Machine, built-in to OSX.  You might want to review the Time Machine Tutorial, and perhaps browse Time Machine - Frequently Asked Questions.
    #27 in the second link mentions some alternatives, too.

  • TS3899 I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month o

    I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month old?

    I upgraded to iOS 7 and I lost emails that were in my inbox - I used to see all emails that I did not delete, now I only have emails from the past month - how can I get the old, undeleted emails back? Or, at least, show email older than one month old?

  • HT201364 My 13 inch Macbook pro w retina will not install/download OS X Mavericks because it says I do not have the requirements in order to install it. I purchased my Mac this past month on 11/20/13 so i do not have a problem with it being an older versi

    My 13 inch Macbook pro w retina will not install/download OS X Mavericks because it says I do not have the requirements in order to install it. I purchased my Mac this past month on 11/20/13 so i do not have a problem with it being an older version. Please help. This is my first computer so i dont have any experience on how to fix this.

    You can't install the App Store version of Mavericks because your model needs a special version. If you ever need to reinstall it, boot into Recovery.

  • IPhoto "Unexpectedly Quit". When I went back in, about the past month's worth of uploaded photos was missing. What happened, and how can I retrieve them?

    IPhoto was open, but "unexpectedly quit".  When I opened it again a couple days later, my most recent photo uploads (for the past month or so) were missing, with dated Events folders saying "no photos". This had happened another time about a year ago? What happened, and how do I retrieve my photos?  I hadn't backed them up, but do they automatically do so on iCloud?

    Assuming you're running iPhoto 9 or later do the following:
    1 - launch iPhoto with the Command+Option keys held down to open the First Aid window. Be sure to follow the circled recommendation in the screenshot.
    2 - run Option #4, Rebuild Database.

  • How to get the planned quantity of past month from md61

    Hi all,
           I couldnt get the planned quantity of past month from the tcode md61.It shows only the current and future month's demand.I want to know the planned quantity of past month's.
    I have checked PBIM,PBED,PBHI tables,here also I am facing the same problem.
        Is it possible to get past month quantity from md61? If No how to know the quantity planned for past month?...Please tel your ideas..
    Thanks in Advance!!!
    Edited by: Ranganayahi Chandirasekaran on Jul 30, 2008 8:17 AM

    Hi,
    You can check History of PIR through MD62 itself.
    Select particular row, Goto Menu, Select Item History(Shift +F6).
    Or
    You may pls execute transaction MD73.
    Plz select option "3 :History Planned ind reqmnts " in the display options and execute the report.
    Regards,
    R.Brahmankar

  • Strange email problem; it started only loading unread emails, but from 3 months ago. It is now loading new emails too, but no emails in the past month, read or unread. It's gmail, set up through the phone, I've restarted restored

    Strange email problem; it started only loading unread emails, but from 3 months ago. It is now loading new emails too, but no emails in the past month, read or unread. It's gmail, set up through the phone, I've restarted restored and updated firmware, deleted the account, anything I could think of, but it's just not accurately downloading the most recent emails.

    The answer is very simple: You were not the original owner of the phone. Target sold you a phone that had been returned. You can verify the date of the original sale here: Apple - Support - Check Your Service and Support Coverage. I suspect you will find that the warranty expiration date is not one year from the date that you bought it.

  • HT3228 IPad 2.   All past months Calendar info disappeared?  From March back?  Why and how can I stop that? Can I get it back?  It is still on my Iphone

    IPad 2
    All past months Calendar info disappeared from March back?  Why and can I get it back?  April and future months info is still there

    Go to "Settings > Mail, Contacts, Calendars > Sync" and set this to "All Events".

  • Programming Logic required for pulling the records for past month /week

    Hi All
    I need help in the SQL programming logic.
    Oracle Database Version: 10.2.0.3.0
    Requirement
    In a data warehouse environment, I need to programme for weekly and monthly automated batch jobs to insert the data from Data_tbl to Reporting_tbl for generating reports. Tables descriptions are given below.
    Table1 - Data_tbl (Source table –this table gets updated everyday).
    Record_dt     first_name     last_name
    Table2 - Reporting_tbl_(Target table)
    Cycle_dt     first_name     last_name
    1. Monthly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’
    Using the above condition in development, I am pulling the data from source table for the past month data. This will be repeated every month and it should be automated.
    i.e., if I run this report any time in dec 2008, it should pick records of dates from Nov 01st to Nov 30th 2008. if I run this report any time in Jan 2009, it should pick records of dates from Dec 01st to Dec 31st 2008.
    Date Values should be assigned for past month. Value of Cycle_dt in target table should be end date of past month like 30-nov-2008, 31-dec-2008.
    2. Weekly Report
    In the SQL Query, I have where clause condition—
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’
    Here week start day is Monday and end day is Sunday.
    If I run the report between Dec 08th to Dec 14th , it should pull records of dates from Dec 01st to Dec 07th 2008.
    On Dec 15th, it should pick from Dec 08th to Dec 14th.
    Value of Cycle_dt in target table should be end date of past week like 07-Dec-2008, 14-Dec-2008.
    Please help me with the logics for both Monthly and Weekly reports.
    Thanks

    Hi,
    For the monthly report, instead of
    Where Record_dt >=’01-nov-08’ and record_dt<=’30-nov-08’say:
    Where   Record_dt >= TRUNC (ADD_MONTHS (SYSDATE, -1), 'MM')
    and     record_dt <  TRUNC (SYSDATE, 'MM')SYSDATE is the current DATE.
    TRUNC (SYSDATE, 'MM') is the beginning of the current month. (Notice the condition above is less than this date, not equal to it.)
    ADD_MONTHS (STSDATE, -1) is a date exactly one month ago, therefore it is in the previous month.
    For the weekly report, instead of:
    Where Record_dt >=’01-dec-08’ and record_dt<=’07-dec-08’say
    Where   Record_dt >= TRUNC (SYSDATE - 7, 'IW')
    and     record_dt <  TRUNC (SYSDATE, 'IW')TRUNC (dt, 'IW') is the beginning of the ISO week (Monday-Sunday) that contains dt. Again, notice the end condition is strictly less than the beginning of the current week.

  • Can we run CK40N for the past month?

    Hi All,
    One of our users forgot to do the cost estimate for the month of May, that's why when he run CK40N (June 1), the prices went to future price, (i think because our MM is still May). I have some few questions and hoping for your positive feedback.
    1.) If we open the June period, will the future price became present price? or we need to run again CK40N?
    2.) Can we run CK40N for the past month of May? Reason is, we would like to capture the prices of Material last May.
    Please advise.
    Thank you in advance.

    Hi Tina,
    CK40N Meant for creatting cost estimates for the product and estimation is some wht which you create for future or current period. It is not possible to run ck40n for the past period.
    Now since you said that period june is not opened in MM. you can not release the price i.e.ck40n for june. check the details fo costing dates you have put in the dates parameters in ck40n. If you have run ck40n for june  then after marking the price system will set the price as a future price and same prices become the current price once you release the price. So if  you r executing ck40n  for june and june is not opened , you can not release the price. First u open the period june then execute the release functionality future price would automatically become the current price for  JUNE.
    Regards / Ashok verma

Maybe you are looking for

  • Store dynamic value in jsp

    hi, i have two page i pass value from one page to another and got it. now i want to store that dynamic value which i pass. i store it and got it my problem is that when page submit then value become null. i have three submit button. my code is <%@ pa

  • Can not connect Weblogic App Server 10.3 from Jdeveloper 10.1.3.5

    Hi Friends, I am trying to connect JDeveloper 10.1.3.5 to WebLogic server 10.3. I am facing some problems. I used JDeveloper 11g to do the same and it worked. I found that JDeveloepr 10.1.3.5 does not have any wizard for Weblogic 10.3 connection, all

  • Dynamic naming for screen fields possible?

    Hi. I am trying to loop through some screen fields, and hence need to dynamically name the fields. I use the following codes, but it gave me an error: IF MAND_CHECK = 'X' AND (TXT_FILE) IS INITIAL. "TXT_FILE is a variable that contains the name of th

  • How to convert a Tcode into Function module or a Bapi

    Dear all, i would like to convert Tcode : ME21N into a Function module or a Bapi to create a Webservice. Kindly help me..!! Thanks in advance.. SreeKumar..

  • Adobe Reader X (10.1)

    After uninstalling and reinstalling the Adobe Reader X (10.1), I am still having problems opening up a PDF file within this program. What it has been doing is shutting down each time I try to view a PDF file. Can someone help me fix this problem plea