Mdx expression to get previous period month

My dimension table has a column for current period month, where every row has the same value, updated at the end of the month. I am using the following expression to get current period month.  "Jan - 2009" is randomly chosen, as every
cell on that column will have the same value.
[Time].[Time].[Month].[Jan - 2009].Properties( "Current Period" )
Result of the above expression is "Feb - 2015".
Current period month will always be previous month of the current year. example: During Jan - 2015, current period month is Dec - 2014.
I need to use this expression or any function to get the previous month. For example if the  current period month is Feb - 2015, then the previous period month should give me Jan - 2015.
How can I accomplish that?

Hi 
I have a similar situation but not with date dimesion we have sales seasons in retails domain.
please check how I am handling this
select (LinkMember ([ProductSeason].[Current Season].firstChild,
[ProductSeason].[Season Name])).prevmember
on columns,
[Measures].[Total pcs]
on rows
from [NewCube]
fsdfasdf
Here I have column currect season which get update at the start of each season with currect season
name. then I am receiving the season name member from product season dimension and fetching the previous member for that.
Hope this will help.
Regards,
Rahul
lntinfotech

Similar Messages

  • How to get previous 2 months from current date in a dropdown?

    Hello Experts ,
                           In the application which I am developing, there is a requirement wherein , I want to Populate current month and previous two month in a drop down depending upon today's date. please help.
    Thanks & Regards,
    Pratbha Shukla

    The internal format for dates is yyyymmdd.  Therefore you can just grab the month value from the date:
    data lv_month type FCMNR.
    lv_month = lv_date+4(2).
    Just subtract from the month to get the two previous.
    data lv_previous1 type FCMNR.
    data lv_previous2 type FCMNR.
    if lv_month = 1.
    lv_previous1 = '12'.
    else.
    lv_previous1 - lv_month - 1.
    endif.
    if lv_previous1 = 1.
    lv_previous2 = '12'.
    else.
    lv_previous2 - lv_previous1 - 1.
    endif.
    Then do your lookup for the month name by reading the table returned from function module MONTH_NAMES_GET.

  • Getting Previous Period Date

    Hello - I'm wondering if anyone can help.
    Im currently developing a tool which filters and aggregates some data. I have the user to be able to select a period for example - 01/01/2010 to 07/10/2010.
    Then, I want to compare the selected data with the same period of the previous.
    I understand that I think I get do this with the .getTime function but Im at a loose end as to how to achieve this. Another example is if the user selects 2 years, e.g. 01/01/2010 - 01/01/2008 the comparison period would be 01/01/2006 - 01/01/2008
    Please help!
    Thanks
    Craig
    public function filterAll(evt:Event):void
                    var tmpDate:Date = selectedFrom.selectedDate
                    var tmpDate2:Date = selectedTo.selectedDate
                    tmpDate.time = tmpDate.getTime();
                    tmpDate2.time = tmpDate2.getTime(); // this needs to be the previous period
                    trace (tmpDate)
                    trace (tmpDate2) // trace previous period

    Think I've done it! Here is the function for anyone that is interested!
    public function getPreviousPeriod(From:Date,To:Date, fromOrTo:String):Date
                    var diffNum:Number = From.getTime() - To.getTime();
                    var tmpDate:Date = new Date
                    var tmpDate2:Date = new Date
                    tmpDate.time = From.getTime();
                    tmpDate2.time = To.getTime();
                    tmpDate.time = tmpDate.getTime() + diffNum
                    tmpDate2.time = tmpDate2.getTime() + diffNum
                    if (fromOrTo == "From")
                        trace ("FROM")
                        return tmpDate;
                    else
                        trace ("TO")
                        return tmpDate2;

  • FM to get previous fiscal month/year and calendar month/year for a date.

    Hi All,
    I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.
    At selection screen, user can select either fiscal or calendar selection.
    Based on the selection, the data will be extracted.
    For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.
    Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.
    Thanks in Advance,
    Regards
    Gowthami

    Hi Gowthami,
    You can use following function module to calculate previous / next day or month or year.
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    =
            sign      = '-'
            years     =
          importing
            calc_date = .
    Here, you can give '-' to sign, if you want previous day / month / year.
    Here, you can give '+' to sign, if you want next day / month / year.
    And depending upon your requirement, you can pass suitable value to days / month / year.
    e.g. To calcualte last month,
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    = 1
            sign      = '-'
            years     =
          importing
            calc_date = wv_prev_month.
    so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.
    Hope this help you.
    Regards,
    Anil

  • Need to get data for month entered in  user prompt to prior 12months.

    Hi,
    I have a report where i need to display total amount for current month  to prior  12 months data...first column will be current month, second column is (current month-1),3rd col: (current month-2)....( current month-12).
    Is there any way I could use current date to get previous 12 months in  variables?
    For example: if  current date is 02/15/2010, I need get  data for 01/2010, 12/2009, 11/2009,....01/2009.
    For example: if I entered Month: 03  and year:2010 in prompt , then I need to get data for prior 12 months to that in the prompt for month:03?.

    The only way to do this is using restrictions on Universe... here you can have the restrictions for every month or a range using the user prompt and the system date.
    Regards

  • How to Get Previous Month Salary for a particular employee?

    Hi
    I am developing a report to get the Net Pay Difference from Previous month.
    I am using logical database pnp.
    My question is how can we get the last month (Previous from current selected month) salary of perticular employee. I read the thread which is related to this but I can't understand the reply's. I think it is due to that I am new in ABAP and my experience in only 22 days. If someone reply with code example then it will more helpful for me.
    Also If you can tell me the table name from where we can get the salary of particular month of particular employee then it will also helpful for me.
    Regards
    Iftikhar

    Hi,
    Payroll data is stored in cluster tables.
    You can either use macro for retrieving the data or Function module.
    1. Use FM -CU_READ_RGDIR for getting the RG directory values.Pass  
      employee Number and molga.You will get all the sequence Numbers from this
      FM.
        The last record will be the latest  one.
    2.  Then Use FM - PYXX_READ_PAYROLL_RESULT for getting the payroll  
         results table.Pass cluster ID- 'IN'  ,pernr ,sequence number for which period
          you want (In your case ,current period minus   1) and
          READ_ONLY_INTERNATIONAL            = 'X',
    3. You will get all the results from PAYROLL_RESULT                     = it_result
      Then you can loop this internal table like LOOP at it_result-inter-rt into wa..
    Get the net pay value(/560 wage type)
    Reward points if helpful.
    Regards,
    Manoj.

  • Costs of previous period not getting settled in current period ?

    Dear All,
    Scenario - Ours is an investment project. User has forgotten to settle costs in previous financial period i.e. 2007. And is now trying to run the settlement via CJ88. Since the financial year/period has already been closed , the system is throwing error as shown below -
    "First settle items from previous year in previous year 2007: 400031819/001
    Message no. AW624 "
    We cannot open the period .
    Tell me how to resolve above issue so that user can post the costs.
    thanks in advance

    hi friend.
    kb11n cant be used here as this is used only for repostings, and this is not required in this scenario,
    i suppose you are getting the error message: AW624 : first settle the items of previous year.
    this error comes when you create a wbs and you are using that wbs as a AUC and posting the expences to that AUC and finally you capitalize that asset to final asset through CJ88  settlement.
    when the capitalization date lies in the next year where in you have the expences posted to that are in previous year.the system dose not allow you to do that as that period is closed. postings cant happen in the previous period thats closed.to rectify this issue go to OBA5 and give the selection AW and select the number 624 and in online and batch column give W. After giving this settings save it and you will be able to perform the settlement.
    this will resolve your issue.
    arman
    sap fico

  • Which table i can use to get standard price of previous periods ?

    Hello, all.
        Which table i can use to get standard price of previous periods ? Example, current period is 2008/11, i want to get the standard price of period 2008/05 .
    Thanks.
    Xinzhou.

    Look in MBEW and MBEWH.
    Regards

  • Financial Report to get data of previous 2 months

    Hi,
    I got a requirement to create a report to show the data of previous 2 months based on the prompted month and year. Suppose if user selects March and year as *2009* then my report should show data for Mar followed by Feb and Jan of *2009*. I am able to create that correctly for the current year if the prompted month is from March to December.
    But if user prompts Jan and Year as *2009* then I should retrieve the report of data*Jan* of *2009* followed by Dec and Nov of previous year that is *2008*. Similarly if user prompts Feb then my report should show the data of Jan of this year 2009 and Dec of *2008*. I have YEAR and PERIOD dimensions in the Column. Could anybody please help me how can I provide such functionality. Thanks in advance.
    Regards,
    Sravan

    Hi Sravan,
    Check the below thread...hope it will help you.
    Very Urgent FR Report
    Regards,
    Mars

  • Getting previous month

    could you please tell me how to get previous month?
    using sysdate gives me current date. from that i can get current month using to_char function. But how can I get the previous month?

    All you ned to remember is that there are two date units, days and months. Everything else is a multiple/fraction of these.
    To increment
    n days:    SYSDATE + n
    n hours:   SYSDATE + n/24
    n minutes: SYSDATE + n/24/60
    n seconds: SYSDATE + n/24/60/60
    n weeks:   SYSDATE + n*7
    n months:  ADD_MONTHS(SYSDATE,n)
    n years:   ADD_MONTHS(SYSDATE,12*n)

  • Closing month - Previous periods - WIP

    Hi people,
    We are try to make closing month (CKMLCP) in previous periods.
    For ths necessity, we have to execute the transactions:
    CKMH: Single Level Material Price Determination and put in the transacction "MUST_SETTLE"
    CKMI: Material Ledger Closing Entries and put in the transaction: "MUST_CLOSE"
    But, when we execute the transaction CKMI with MUST_CLOSE, the system shows us:
    Execute WiP Price determination for material
    Question: Whats is the transaction we have to execute WIP in previous month as the transaction related and what´s the transactio we have to put as MUST_SETTLE or MUST_CLOSE.
    Thanks,
    Rosana.

    Hi.
    I dont fully understand your question.
    1. Do you have WIP Revaluation Active?
    2. Indeed, you must run all the steps in the ML Close, not only the single level (CKMH) and the Posting (CKMI). You see all the steps in CKMLCP cockpit. And can use the MUST_xx in this tcode,
    I guess your problem is because you have the WIP Revaluation functionality active. This step dont have tcode, but you can use se38/WIP_PRICE_DETERMINATION
    Check the OSS of the previous post for more details.
    Arturo.

  • Manual postings to PCA for previous periods seems to get posted twice

    Dear All,
    Actual postings to PCA are performed manually using a custom job from SA38. Postings were made in FI for all previous (closed) periods . After running those jobs for previous periods to transfer those entries, some companies and accounts are showing duplicate amounts or just a balance on comparison ledger and not in base ledger. How to correct this.
    Thanks a lot for your help

    Hi
    You will have to use 9KE0 or a custom job again to rectify this
    Ajay M

  • How to get "Valuated unrestricted-use stock in previous period"

    Hi!
    I need the Valuated unrestricted-use stock in previous period for a material.
    I'm using the MCHB table but CVMLA field doesn't match with the value calculated by standard tcode.
    There is any FM that can help me?
    Thanks
    Salvatore

    Problem solved

  • FM to get the previous fiscal month

    Hi All,
    is ther any function module to calculate the previous fiscal month from the sy-datum.
    Tnhanks in Advanc
    Moderator message: date calculation questions = FAQ, please search before posting.
    locked by: Thomas Zloch on Sep 29, 2010 2:28 PM

    Hi,
    Use the FM: RP_CALC_DATE_IN_INTERVAL
    DATA:date1 TYPE sy-datum.
    START-OF-SELECTION.
      CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
        EXPORTING
          date      = sy-datum
          days      = '00'
          months    = '04'
          signum    = '-'
          years     = '00'
        IMPORTING
          calc_date = date1.
      WRITE date1.

  • SSIS Expression to get yesterday's date

    Hi ,
    I used the following expression to get yesterday's date :
    (DT_WSTR,4)YEAR(GETDATE())
    + RIGHT("0"+(DT_WSTR, 2) MONTH(GETDATE()) ,2)
    + RIGHT("0"+(DT_WSTR, 2) DAY(DATEADD("dd", -1, GETDATE())) ,2)
    It returns correct date but fails on last day of the month. Eg : If today is Feb 01 ,2015 , this expression returns 
    20150231 (Feb 31 2015) . It should return 20150131 (Jan 31 , 2015) . What expression to use to get correct previous date?

    this?
    (DT_DATE) DATEADD("DAY",-1,GETDATE())
    if you dont have timepart use
    (DT_DATE) (DT_DBDATE) DATEADD("DAY",-1,GETDATE())
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for