Formula to calculate two fiscal year/period difference for non null quantit

We'd like to have a query result like the following:
Person -- Jan_2007 -- Feb_2007 -- Mar_2007  --  No. of Months
Tom --- 21 --- 54 --- 10 --- 2
John --- 0 ---  3 --- 15 --- 1  
In the above query, the row is sales persons, the 1st three columns list the sales quantity by each sales person restricted by fiscal year/period and we would like to create 4th column "No. of Months" to calculate (will use formula) the month span (difference) for each sales person from his last sale activity (the last month he performed sales) and the 1st sale activity (the first month he performed sales) as listed in the above query result, e.g.,  Tom performed his first sales (sales quantity: 21) in the month of January of year 2007, and he performed his last sales (sales quantity of 10) in the month of March, 2007, then the "No. of Months" column value for Tom is 2.  The calculation formula will be performed based on the last quantity value (> 0) to trace it's corresponding column fiscal year/period value (max of the fiscal year/period value with quantity value >0) and on the 1st quantity value (>0) to trace it's corresonding column fiscal year/period value (min of the fiscal year/period value with quantity value >0) and then do the subtraction between the max of the fiscal year/period value and the min one. 
Would be appreciated if BEx experts here give the detailed steps on how to build up this formula to calculate the number of month difference and we will give you reward points!
Edited by: Kevin Smith on Mar 18, 2008 1:47 PM

hi Danny,
I only gave an example of 3 columns, but actually, yes, the report can have more than 12 months, e.g. from Jan_1999, Feb_1999, ..., Mar_2011, Apr_2011.
In our simple example of 3 columns for the three consecutive months, if John had (3)(0)(15), then the No. of Months is 2, or the last month value he performed sales and 1st month he performed sales.
You said macro in Excel sheet?  Not sure if macro will work on web since we will eventually run the reports on web browser, therefore we still prefer using Formula.
Any idea/solution?
Thanks!

Similar Messages

  • Selection criteria is fiscal year/period but need to restrict KF by date

    Hi,
    I have query where selection criteria is based on fiscalyear/period and in result I need to have Netvalue for all the sales order by created on date for that fiscal year/period.
    For eg if I have entered fiscal year/period as 008.2007, I should get net value for all the orders that have created on date between 08/01/2007 to 08/31/2007.
    Can anyone help me about this please.

    Hi DV
    Here is the code
    put it in I_STEP=2
    WHEN 'EXIT NAME"
    READ TABLE I_T_VAR_RANGE INTO loc_var_range with key vnam = 'userinput variable name'
    v_fiscal_year = loc_var_range-low_0(4)
    v_period = loc_var_range-low+4(3)
    CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
              EXPORTING
                i_gjahr              = v_fiscal_year
              I_MONMIT             = 00
                i_periv              =  Give your fiscal year variant name
                i_poper              = v_per
             IMPORTING
               e_date               = v_date_beg
             EXCEPTIONS
               input_false          = 1
               t009_notfound        = 2
               t009b_notfound       = 3
               OTHERS               = 4.
            CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
              EXPORTING
                i_gjahr              = v_fiscal_year
              I_MONMIT             = 00
                i_periv              =  Give your fiscal year variant name
                i_poper              = v_per
             IMPORTING
               e_date               = v_date_end
             EXCEPTIONS
               input_false          = 1
               t009_notfound        = 2
               t009b_notfound       = 3
               OTHERS               = 4.
            CLEAR s_range.
            MOVE:
              v_date_beg TO loc_range-low,
              v_date_end TO loc_range-high.
              loc_range-sign = 'I'.
              loc_range-opt = 'BT'.
            APPEND s_range TO e_t_range.
    Thanks
    Tripple k

  • Function Module to find difference of Fiscal Year period

    Hi,
    I have a requirement wherein a user enters 2 variables for Start and End Fiscal year period and I need  to calculate the difference ( ie: I need to calculate the number of periods ).
    I also need to pass the Fisc Year variant 'K4' as the Input parameter.
    Any standard function module for it?
    Rgds
    Shyam

    DATA: I_FYV1 LIKE T009-PERIV.
      CALL FUNCTION 'CCODE_GET_FISCAL_YEAR_VARIANT'
        EXPORTING
         COMPANY_CODE           = i_billno-bukrs
         COMPANY_CODE           = S_BUKRS-LOW
        IMPORTING
          FISCAL_YEAR_VARIANT    = I_FYV1
       EXCEPTIONS
         COMPANY_CODE_NOT_FOUND = 1
         OTHERS                 = 2.
    IF SY-SUBRC <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      CALL FUNCTION 'ME_DETERMINE_GJAHR'
       EXPORTING
      I_BSTYP         =
          I_BEDAT         = P_DATE
         I_PERIV         = I_FYV1
      IMPORTING
      E_H_MONAT       =
        E_H_GJAHR       = GJAHR1
      E_H_DATUM       =

  • Issue with Fiscal Year period - Variable

    Hello,
    I have requirement where I have two fiscal year variables selections available for the users. Both are independent to each other. FOR EX: A & B
    1ST Fiscal year period is straightforward. It is a single variable selection where User enters the fiscal year period then the Key figures data will be available to the user for that particular fiscal year what is selected in the variable screen.
    For ex: If user enters 01.2007 then the values will be only for that particular month/period
    However, the 2nd Fiscal year period user wants a Range (From and to). This is also a Single selection variable. Here user enters only TO value, which it should go and get the lower value from first variable screen and then it should take the higher value from the 2nd Variable screen and should calculate the result as a range.
    How this can be sorted? Can someone please help me to sort this Issue? If we need a customer exit, can you please give me some sample code?
    Thanks in advance
    Harish

    Hi,
    Create 3 variable
    One for from variable which will user input ZVAR1
    2nd to variable will be user input              ZVAR2
    3rd variable be variable exit type              ZVAR3
    In exit populate the VAR3 by reading the two user input variable.
    and use the option
    Try this:
    <b> when 'ZVAR3.
          if i_step = 2.
            read table I_T_VAR_RANGE into z_t_var_range
                            with key VNAM = 'VAR1'.
            read table I_T_VAR_RANGE into z_t_var_range1
                            with key VNAM = 'VAR2'.
                 ZE_T_RANGE-SIGN    = 'I'.
                 ZE_T_RANGE-OPT     = 'BT'.
                 ZE_T_RANGE-LOW     =  z_t_var_range-LOW
                 ZE_T_RANGE-HIGH     =  z_t_var_range1-LOW
                 APPEND ZE_T_RANGE TO E_T_RANGE.
                 clear ZE_T_RANGE.
          ENDIF.</b>
    Thanks,
    Debasish

  • BSC:  Display values for Fiscal Year/Period

    Hi all,
        We are trying to create a small test scenario to know about balance score card. We have a cube which has Actual and Plan data in one KF diffentiated based on Value type character. Time character is fiscal year/period.
    We want to display a graph which displays actual and plan for fiscal year/period wise. But when we execute the score card it shows the total year's plan and actual for the individual fiscal year/period. But ideally it should display actual and plan for the respective fiscal year/period.
    we have created two value field in the measures of score card. and formula a/b (Plan / Actual ) is used.
    Please guide us in solving the problem.
    Regards,
    PM

    <FONT FACE = "Tahoma", Font Color = "Blue">
    Hi
    <Br>
    Do you have Fiscal Year Period in the Rows of your BW Report? If not, please try that.
    <Br><Br>Hope it helps.
    <Br>
    Cheers
    Abhijit
    <Br>* It's a good habit to reward someone with points in SDN if you think his/her
    response was helpful to you
    </FONT>

  • Current month and previous months of fiscal year period data

    Hi All,
    My requirement is end user will enter month ie (fiscal year period ) and in report my requiremnt is to show data in two columns 1.Current month data  and
    2.April till date.
    Please let me know how to do this and please send the coding to be done in CMOS.
    Regards

    Hi,
    In your query, you should have following object :
    in filters:
    fiscal period object, with an user entry variable on it (UE_MONTH)
    in rows/ratios:
    Current month column, with your KF and a restriction on 0calmonth2 with an customer exit variable on it (ie: CE_VAR1)
    same for April column. (CE_VAR2)
    in your customer exit, CMOD, step 2, add these two cases :
    WHEN 'CE_VAR1'.
    READ TABLE i_t_var_range WITH KEY vnam = 'UE_MONTH' INTO
                       intern_range.
    CONCATENATE intern_range-low(6) sy-datum+4(2) INTO l_s_range-low.
    l_s_range-sign   = 'I'.
    l_s_range-opt    = 'EQ'.
    APPEND l_s_range TO e_t_range.
    Same for April, add a new case and just replace sy-datum+4(2) by '04'.
    Hope it helps,

  • Q1: Secondary Index. Q2: Fiscal Year /Period

    Hi gurus,
    I have two questions need your explain:
    Q1: To improve the query performance I am going to create some secondary indexes on an ODS, I am wondering whether this action will remove the data from the ODS therefore I have to reset the data loading process and if these indexes can be maintained while data loading automatically ?
    Q2: About fiscal year /period which technical name is 0fiscper. we know in sales order header, item also purchase order and billing ODS or CUBEs, FY/Period are existed in those models. but there are still some other dates e.g. delivery date, goods issue date, goods recieve date, document date, posting date and so on. So which date is used to generate FY/Period ?
    Thanks in advance
    Edited by: Leon Ouyang on Dec 3, 2008 4:27 PM
    Edited by: Leon Ouyang on Dec 4, 2008 1:26 AM

    Hi,
    1)The creation of index have no effect on the data stored and you need not delete or relaod the data.
    System will adjust the index with every data load to the DSO automatically.
    2)Fiscal year period depeneds upon the module from which you are using the data and you can tweak the logic for this suit your need.
    If the data source is providing the fiscal period values then well and good.
    If not then generally its mapped to those dates which are driving date of the query or the date which is going to be used by the user for the input selections in the report.
    for example if you want sales based on the posting date in the reports and user just wnt sale till month and not date then.......you map posting date to fiscal period in the transformation and use them in the reporting.
    This can vary too...there is no hard fast rule for what date it should be mapped...and it all depends upon the reporting requirement
    The good design practise is to fill it with the same date which is filling calday and calmonth objects.This will keep granuarlty as same...but if you want some other selection in the report then you can map calday to some other date and fiscal period to some thing else.
    Ajeet

  • How to capture the data if i am using two Fiscal year variant

    Hi
    My client is required need two type financial statement one is as per company act and calender year.  Other one is company act and fiscal year.
    regarding we have maintain two fiscal year variant one is assigned to company code as per calender yr other one is assigned to Spl.Pr G/L. but how to capture the financial data from company code in case we are using two fiscal yr variant.
    Rekha

    Hi
    U cannot maintain two two fiscal year varaint for a company code in GL. As said by u maintain one fiscal year varaint for GL and the other one for FI SL. When u post FI document in GL automatically the same will flow into FI SL for the corressponding period.
    For example ur Fiscal year varant is April to March in GL
    and Callendar year in FI SL and u do a posting in April 1 (period 1) in GL then it post it to  4th period in FI SL automatically since April is the 4th period in FI SL since it uses K4 as the fiscal year variant.

  • Postings in shortened fiscal year period

    Hi expert,
    We are trying to do a fiscal year change from Fiscal year variant V3 with Non Calendar year Apr to Mar to Calendar year. 
    This will result in shortening the fiscal year to 9 periods and omitting period 10 to 12.
    However, for the company that we are trying to change the fiscal year variant, there are CO posting made to period 10 and 11.
    We understand that there are many documentations that there should not have postings in period 10 and 11.  What else can we do to enable us to enable the shortened fiscal year ? Will reversing the documents make any difference?

    Hi Markus,
    Thanks for your instant reply. I have activated the key and set the OAYP settings in FI-AA
    Anything else ,please let me know.
    Perinkulam

  • Can we only year value from "0FISCPER" (Fiscal Year/Period) at BEx level

    Hi all,
    I have two time characteristics "0FISCYEAR" (Fiscal Year) and "0FISCPER" (Fiscal Year/Period). In DSO initially "0FISCPER" was there and later request came to add "0FISCYEAR". Now data in char. "0FISCPER" is since beginning (from 2000) and for char. "0FISCYEAR" is since 2010.
    User's requirement is to create a report which will display data Year wise.
    My issue is if i am using "0FISCYEAR" then user is not able to see year instead it shows #. I dont want to do data reloading as this is GL data and hold huge no. of records in it.
    So my concern is : Is there any way to use only year value from "0FISCPER" (Fiscal Year/Period) at BEx level? Is there any setting which I can apply and get the same value of Year as I can see from "0FISCYEAR". Please assist me on this.
    Thanks,
    Arvind

    Hi Arvind,
    Your requirement can be realised through virtual characteristics.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b04be008-86cc-2c10-4bad-e517ea3f4c80?QuickLink=index&…
    however, I would still suggest to reload the data. you will only need to reload years before 2010 and you can do this in phases.
    Hope this helps.
    -Swati.

  • Custome variable exit for fiscal year/period

    Hello BW Gurus,
    Q1[1,2,3] Q2[4,5,6] Q3[7,8,9] Q4[10,11,12] quarterly periods
    I have a custom variable exit as shown for fiscal year period
           IF LOC_VAR_RANGE-LOW+4(3) =< '003'.
              L_S_RANGE-LOW+4(3) = '001'.
           ELSEIF LOC_VAR_RANGE-LOW+4(3) > '003' AND
                                              LOC_VAR_RANGE-LOW+4(3) =<'006'.
              L_S_RANGE-LOW+4(3) = '004'.
           ELSEIF LOC_VAR_RANGE-LOW+4(3) > '006' AND
                                                LOC_VAR_RANGE-LOW+4(3) =< '009'.
              L_S_RANGE-LOW+4(3) = '007'.
           ELSE.
              L_S_RANGE-LOW+4(3) = '010'.
           ENDIF.
    Now this works fine to give me the Current Quarter ....say if user puts 005/2007 i get the data Current quarter as [4+ 5] i.e. April and MAy data. Now for <b>Previous Period</b> I gave an offset as -3 to -1 inorder to get data for Q1[123] but the requirement is changed and I want the same time period i.e. [1+2] and not the entire quarter since the Current Quarter calculates only for 4 and 5.
    I hope u are getting my point....please give your suggestions will reciprocate with lots of points

    Hi gaurav,
    Basically If I am selecting period 005 I am getting the data for 4 and 5 as Current Quarter i.e. April is the starting period of that Q2.
    Similarly the previous Quarter should also give me data for period 1 and period 2.
    Right now the offset I gave is -3 to -1 on my custom variable so i am getting data for the entire previous quarter which is Q1[1,2,3] but in reality i just want data for period 1and period 2.
    Can you please help me in this
    Appreciate your concern
    Thanks

  • Custom exit variable for fiscal year/period

    Hi BI Experts
    1) In one of the column i just want Budget data to be displayed for the entire year..i.e even if the user enters 005/2006 for fiscal year /period that column should display 001/2006 to 012/2006 Budget.
    I have created a restricted KF for 0AMOUNT restricted by version(for Budget), valuetype (for Budget )
    now how do I assign variable for Fiscal year/period...and the problem is posting period is not populated ...I mean there is no transformation for that...
    Can you share your experience on that ...full points wil be awarded...
    Thanks

    Hi Ajay and Pradhiba
    I am really sorry for assigning you guuys points ...wasa bit busy ...
    The problem is that the year and posting period is not populated...there fore I cannot use those time characteristics...
    Now I have only fiscal year/period populated..now i want
    if the user enters 005/2006 ....i want my first column to calculate the data for 001/2006 to 012/2006 ...thats the req...
    can u share ur ABAP experience in that...
    thanks

  • Invalid value for Fiscal year/period

    Hi all,
      I have an user exit variable which populates the fiscal year period value from two separate fields.
    1) Fiscal Period
    2) Fiscal Year
    But when I contatenate it and place it in the format 200601 the report in BEx gives me the error
    "Value 200601 for user-exit variable ZRMA_FIP is invalid"
    ZRMA_FIP is my variable name
    The code I have is:
    WHEN 'ZRMA_FIP'.
      l_yr_zrma_fip = l_v_cur_year.
      l_per_zrma_fip = l_v_cur_period.
      CONCATENATE l_yr_zrma_fip l_per_zrma_fip INTO
    l_calmth_zrma_fip.
            r_vari-low = l_calmth_zrma_fip.
            r_vari-sign = 'I'.
            r_vari-opt = 'EQ'.
            APPEND r_vari TO e_t_range.
        ENDCASE.
    I thought I had to take care of internal/external format but nothing is working...can anybody help?
    thanks

    Hi
    I have demo code
    hope that will help u.
       WHEN 'ZMXFIPED'.
    clearing the storage areas used above.
         CLEAR: l_s_range , loc_var_range .
    checking step if it is after inputing the variable value.
         IF i_step = 2.                "After selecting of input variable
    looping at interval range table .
           LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'ZMSFPER8'.
    assigning values to year and period values.
             l_year_exit   = loc_var_range-low+0(4).
             l_period_exit = loc_var_range-low+4(3).
    putting the from and to values together with year and period values.
             CONCATENATE l_year_exit '001'  INTO l_s_range-low .
             CONCATENATE l_year_exit l_period_exit INTO l_s_range-high .
    sign I-> includes the range between.
             l_s_range-sign =  'I'.
             l_s_range-opt =   'BT'.
    appending the fianl interval range table.
             APPEND l_s_range TO e_t_range.
    exiting after appending.
             EXIT.
           ENDLOOP.
    clearing the storage area for next iteration.
           CLEAR: l_s_range .
         ENDIF.
    by using tha logic u can try.

  • Texts for Fiscal Year Period

    Hi all
    We are currently using Fiscal Year Variant Z6(July - June, 4 special periods).
    When we display the texts for Fiscal Year Period in a Query it displays as CALMONTH FISCYEAR. E.g. July 2004, which is FISCPER 01.2004 but Calmonth 07.2003 (July 2003). I want the texts to display as the correct calendar year month, not as a combination of calendar month with the fiscal year.
    I have tried to maintain the texts of 0FISCPER, but I get the following message "The master data table of char. 0FISCPER is not generated, operation terminated"
    Has anyone managed to solve this problem?
    Thanks in advance
    Chami

    Chami,
    I see the problem. The Year Part of the Text is wrong.
    Unfortunately this means that Fiscal Year cannot be used to display the texts.
    The solution to your problem is to have the description from the calendar month/year in the column headings by adding the calendar period to the data target, convert the fiscal period to calendar period on data loading (using provided date conversion functions in the formula builder) and use it for display purposes. The fiscal year is still used as selection criteria (as a filter)
    The other solution is to have text variables created from the Calendar period and used in the column headings
    Hope that helps!
    Rishi

  • Text Variables to show Start and End Date of Fiscal Year Period

    Hi,
    I am creating a query that has user enter a starting fiscal year period and posts information by Fiscal Year Period going back 14 periods.  I am able to put the fiscal year period in the heading for all periods, but would also like to add the start and end calendar day for each listed period.  Can that be done using a replacement path text variable or is that something more for a customer exit variable?
    Thanks in advance for any thoughts provided.
    Bill

    Hi,
    This is one of my exit that display the calmonth (offset -12). Usefull when I have to retrieve in a KF a complete rolling year depending one calmonth.
    S_VMUCMN is my selection variable
    S_TXTCMN_M12 is my text variable calmonth-12
    S_TXTCMN_M0 is my text variable for selected calmonth.
    WHEN 'S_TXTCMN_M12'.
        IF i_step = '2'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'S_VMUCMN'.
            CLEAR l_s_range.
            " First day of the selected month
            CONCATENATE loc_var_range-low '01' INTO l_calday.
            CALL FUNCTION 'YFRBW_FUM_CAL_DATE_IN_INTERVAL'
              EXPORTING
                date      = l_calday
                months    = 12
                signum    = '-'
              IMPORTING
                calc_date = l_calday.
            l_s_range-low = l_calday+0(6).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    Thus, in KF header you have to put the two text variable to display the complete period.
    Hope it helps,

Maybe you are looking for

  • How to I get my site to open at my host?

    This is going to sound kind of stupid. Fatcow is my host and Dreamweaver is my 3rd Party web builder. All connections are fine (see pic) and the files all transferred just as they should have (see pic) for a simple 2-page "practice" site. So what's n

  • CoreAudio troubles...

    For some reason today when I launched LogicPro (7.1), every time I hit "record" on an audio track the lead-in starts playing, then dissolves into distortion, then stops, and an error comes up: Core Audio: Disk is too slow (Record) (-10004) I have res

  • Why does Firefox 8 lose its settings between sessions?

    Version 8 does not hold its settings from one Windows session to another. I have to keep turning the menu bar back on and resizing the window (the default of the left half of the screen -- absolutely WORST place it could be -- keeps coming back!). Fi

  • Read & Applied Other Threads Win Still Fatally Crashes When Running iTunes

    I updated all the drivers on the system to the latest from the manufacturer websites yesterday. I then installed and ran WinDbg it is telling me RtkHDAud.sys (R+k HDAud+179e98) is the culprit causing a double fault. When I disable Realtek High Defini

  • Importing a DVD with CS5

    I am trying to figure out how to import a unprotected DVD into a project with CS5 premiere When I use File >Import and browse to my DVD disk I see the usual VOB's in the video folder. Is there indeed a "direct" way to easily import a DVD into premier