MDX YTD until previous month - problem for january

Hello,
I have a Time hierarchy YQMD
I want to make an MDX calculation that  gives me the YTD until the previous month.
I did this with formula:
I first made a 'normal' ytd calculation resulting in 'MyMeasureYTD'
sum
(YTD([Time].[Years Quarters Months Weeks Days]),[Measures].[MyMeasure])
and then I use the following formula
ParallelPeriod([Time].[Years Quarters Months Weeks Days].[Months]),[Measures].[MyMeasureYTD]
this works fine for all months except for january: when the selected month is 'january' (of any year) , the result should be NULL, instead of the YTD until december of the previous year (which is what the formula above gives me).
I have tried with using an iif in the formula that checks on currentmember being the firstchild, but I don't seem to get the required result.
I would be very gratefull for your help!
kind regards
Sylvie

Hi Sylvie,
Please refer to the MDX below with AdventureWorks sample:
with member [x]
as
iif([Date].[Calendar].currentmember is
Ancestor([Date].[Calendar].currentmember,3).firstchild.firstchild.firstchild,
"NULL",[Measures].[Internet Sales Amount])
select [x] on 0,
[Date].[Calendar].[Month].members on 1
from
[Adventure Works]
In my scenario, the hierarchy of Date Calendar is Year->Half Year->Quarter->Month->Day. So my Ancestor() function need to step back 3 levels. If you date hierarchy is Year->Quarter->Month->Day. It should be:
Ancestor
([Date].[Calendar].currentmember,2).firstchild.firstchild
If you have any question, please feel free to ask.
Regards,
Simon Hou
TechNet Community Support

Similar Messages

  • How to Bring the Quarter Period and Previous Month Value for given Input

    Hi to all,
          I want bring Quarter Period and Previous Month value for the given Input. Plz help me on this
    Example :
    Input : 06.2008
    Output:
    Input     Prev.Month  Quarter 1   Quarter 2   Quarter 3 
    06.2008  05.2008      03.2008     12.2007     09.2008
    12.2008  11.2008      09.2008      06.2008    03.2008
      Is there any Standad Exit for this or we have to write coding ?
    Regards,
    Saran

    Hi,
    You can solve this by using Replacement path.There you have a option offsets.Here give the current period.Based on that give the number which previouse month you suppose to want.
    I think this 'll help you
    assign points if this helps
    Regards
    JT Goud

  • 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.

  • J2iu Not Showing Previous month Balances For PLA (High Priority)

    Dear Gurus
    We are using Transaction J2iu for Fortnight Utlization. Now When we are
    trying to utlize PLA for the second Fortnight Of month March 07, The
    System is only showing the Current Month Balances ie The Balances for the
    month Of March 07 , And not accounting the balances for the previous months.
    Kindly Suggest .

    Carry Forward the GL Balances to Next Year i.e in Apr.07 &
    then Try it out again.
    Sometimes, System takes into account reatime balances & not balances as on particular posting date.
    Regards..
    Ameya...

  • MDX calculation based on date logic for the Jan 1 of current year through the 15th of the previous month

    Hello, 
    We need some help with an SSAS MDX query based on date logic. One of the problems is that I don't have access to the Cube but have been given a query example with the logic needed for the calculation. Here's the scenario; 
    The ETL process will run on the first Tuesday after the 15<sup>th</sup> of a given month. The Analysis Cube data queried should include the current year up to the end of the previous month. For example, on May 19<sup>th</sup>
    (the first Tuesday on or after the 15th) the query should include data from January 1<sup>st</sup> through April 30<sup>th</sup>.
    The 15<sup>th</sup> of the month is not part of the query, it is a factor in when the query is run. The query will always be in terms of complete months.
    SELECT
                    NON EMPTY { [Measures].[Revenue Amount],
                    [Measures].[Utilization],
                    [Measures].[AVG Revenue Rate],
                    [Measures].[Actual Hours] }
    ON
                    COLUMNS,
                    NON EMPTY { ([dimConsultant].[User Id TT].[User Id TT].ALLMEMBERS * [dimConsultant].[Full Name].[Full Name].ALLMEMBERS * [dimConsultant].[Employee
    Type].[Employee Type].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION,
                    MEMBER_UNIQUE_NAME
    ON
                    ROWS
    FROM
                    ( SELECT
    ( { [dimDate].[Week Date].[1/4/2015], [dimDate].[Week Date].[1/11/2015], [dimDate].[Week Date].[1/18/2015], [dimDate].[Week Date].[1/25/2015], [dimDate].[Week Date].[2/1/2015] } )
                    ON
                                    COLUMNS
                    FROM
                                    ( SELECT
    ( { [dimIsBillable].[Is Billable].&[True] } )
                                    ON
    COLUMNS
                                    FROM
    [SSASRBA]
    WHERE
                    ( [dimIsBillable].[Is Billable].&[True], [dimDate].[Week Date].CurrentMember ) CELL PROPERTIES VALUE,
                    BACK_COLOR,
                    FORE_COLOR,
                    FORMATTED_VALUE,
                    FORMAT_STRING,
                    FONT_NAME,
                    FONT_SIZE,
                    FONT_FLAGS

    Hi Hans,
    Thank you for your question.  
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
    Thank you for your understanding and support. 
    Regards,
    Simon Hou
    TechNet Community Support

  • For selection parameter the default date should be of the previous month.

    Hi all,
    In my selection-screen what i want is  for the selection parameter "Selection period month" the default value to be the previous month.
    For example today is 24.09.2008 so the default value of this field has to be 200808 instead of 200809 today.
    please tell me how should i do this.
    thanks in advance.

    Hi,
    Check the following code:
    data: f_date type sy-datum,
          f_dd(2) type c,
          f_mm(2) type c,
          f_yyyy(4) type c,
          f_pdt type sy-datum.
    parameters: p_date like sy-datum.
    initialization.
    f_date = sy-datum.
    f_dd = sy-datum+6(2).
    f_mm = sy-datum+4(2) - 1.
    f_yyyy = sy-datum+0(4).
    if f_mm eq 0.
    concatenate f_yyyy '12' f_dd  into f_pdt.
    elseif f_mm eq 1 or
       f_mm eq 2 or
       f_mm eq 3 or
       f_mm eq 4 or
       f_mm eq 5 or
       f_mm eq 6 or
       f_mm eq 7 or
       f_mm eq 8 or
       f_mm eq 9.
    concatenate f_yyyy '0' f_mm f_dd  into f_pdt.
    else.
    concatenate f_yyyy f_mm f_dd  into f_pdt.
    endif.
    p_date = f_pdt.
    start-of-selection.
    write : / f_date,
             / f_pdt.
    Regards,
    Bhaskar
    Edited by: Bhaskar Chikine on Sep 24, 2008 12:49 PM

  • Set default value for date/time to previous month

    Hi All
    I have two date/time parameters in my report and I want to set the default value for both the parameters
    For start date parameter I want the first date of previous month and for end date parameter I want the last date of previous month.
    Can someone please point me to the right direction
    Thanks
    Rone

    Hi Rone,
    These links can be helpful for you:
    http://www.bidn.com/blogs/hardikabhavsar/bidn-blog/1639/default-date-parameters-in-ssrs
    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/584a98ae-bb75-4740-9198-e6be3c1aec12/
    Regards,
    Manoj
    *Happy to help
    http://experiencingmsbi.blogspot.com/

  • Records for parameter month and previous month

    Hi,
    I have a request where the user parameter is calender year month (YYYYMM).I need to show the records of both the entered month and previous month.
    For ex: if the user enters 201107, I need to show the records of 201107 and 201106.
    Also,I am not using dashboards.
    Any suggestion...
    Thanks

    No, I don't see this as a solution. A session prompt can only be overridden by using a Request Variable, but they are found in Dashboard prompts which you have excluded as a solution. Therefore, any session variable you set would be "hard-coded" eliminating end-user interaction. Sorry.
    You will need to deploy dashboards for this. I will also add this: eliminating dashboards really restricts the power of OBI because it makes it difficult to implement interactive reports such as the one you are building. Perhaps you should use this example as a push to consider adding the value of dashboards to your environment.
    As this is useful information to others, please mark applicable posts that resolved your question. Thanks.

  • Previous Month Data

    Hi Friends,
          Good day,
    I want to get the previous month balance.
    Here is the my business scenario. I am going to enter the month and year then i can get the values corresponding to this month and year, but in this i want previous month data for one object or one measure.In that query i set the two filter
    Enter Month Name:
    Enter the Year:
    Say for ex, if i enter August means i need all august month data plus i need previous month balance for balance object.if i suppose enter January and year is 2008 means. I need December month data for year 2007 for the balance object and for remaining i need January month Year 2008 data.
    Any Suggestions,
    Thanks lot,
    Regards,
    -B-

    Hi Balaji,
    You are a lucky guy, that's why getting these much reply. Congratulations friends for your good replys. I also find a solution with access database and  if and mod operation.
    temp.Yr ; =  @prompt('Enter Year:','A','Time period\Year',Mono,Free,Persistent,,User:0)
        AND
    temp.Mth ; = @prompt('Enter Month:','N','Time period\Month',Mono,Free,Persistent,,User:0)
       OR
    temp.Yr ; = @prompt('Enter Year:','A','Time period\Year',Mono,Free,Persistent,,User:0) - (IIF(@prompt('Enter Month:','N','Time period\Month',Mono,Free,Persistent,,User:0)=1,1,0))
    AND
    temp.Mth ; =( (@prompt('Enter Month:','N','Time period\Month',Mono,Free,Persistent,,User:1)+10)mod 12)+1
    The filter contain...
    ............year equal to @year
    ........and
    ............month equal to @month
    or
    ............year equal to @year
    ........and
    ............month equal to @month
    Regards
    Eldose

  • How to find first and last day of previous month?.

    Based on current month, I want to find start and end day of
    previous month.
    For example,
    For august, Start date is July 1st and End date July 31st.
    How can i get first of previous month as start date and last
    day of the previous month as end date?.
    Same way,
    i want to find start date of current month and end date of
    next month.
    Example:
    For august,
    i want to get start date, august 1st and end date : september
    30.
    How can i do this from current date or now().
    I am looking for best and easy way to find start and end
    dates..
    Thanks

    <cfset today = now()>
    <cfset firstOfThisMonth = createDate(year(today),
    month(today), 1)>
    <cfset lastOfNextMonth = dateAdd("d", -1, dateAdd("m", 2,
    firstOfThisMonth))>
    <cfoutput>
    today = #today#<br>
    firstOfThisMonth = #firstOfThisMonth#<br>
    lastOfNextMonth = #lastOfNextMonth#<br>
    </cfoutput>
    Edit - To find the start and end day of previous month, get
    the first of THIS month. Use Subtract 1 month ("m") to get the
    start date. Subtract 1 day ("d") to get the end date.

  • Problem in measure for previous month

    i have columns like following
    d_name Value
    JAN-11 4586236
    FEB-11 2121512
    MAR-11 32121
    APR-11 12121
    p_name is varchar2 type
    Now i need value for previous month can u do it without using queries or obiee
    I am unable to build hierarchy cause of its type. any suggesions

    You might have month numbers in rpd, use ago function to get previous month value

  • Struggling with MDX Filter Expression for Previous Month in SSRS

    I am trying to query only data from the previous month. 
    I looked at my Month member and the it looks like so... [Date].[Calendar].[Month].&[2015-04-01T00:00:00]
    Here is my filter expression:
    StrToMember ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" ).lag(1)
    I am not getting any errors, I am just getting getting "No rows found" - however there is certainly data in last month. I even tried removing the lag() function thinking that might be causing it, but there are still no errors, just no rows returned.
    Here is the complete query:
     SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[" +
    format(now(),"yyyy-MM") +  "-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 

    Hi S,
    I can't tell exactly what your issue is, but I can give you a couple of tips to help diagnose it.
    Try the following queries. They aren't fixes, just simplifications of your query to help you diagnose where the issue is.
    --This query will let you what your string function is returning with what you want.
    With member measures.x as "[Date].[Calendar].[Month].&["
    + format(now(),"yyyy-MM") +  "-01T00:00:00]" 
    member measures.y as [Date].[Calendar].currentmember.uniquename
    select {measures.x,measures.y} on 0
    [Date].[Calendar].[Month].&[2015-04-01T00:00:00] on 1
     from [data warehouse]
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember ("[Date].[Calendar].[Month].&["
    + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date with lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, [Date].[Calendar].[Month].&[2015-04-23T00:00:00].lag(1)  on rows FROM [Data Warehouse]) 
    --This query will give you the date with lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" ).lag(1)  on rows FROM [Data Warehouse]) 
    --This query will show you the member without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY
    { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[2015-04-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 
    --This query will show you the member without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, NON EMPTY
    { ([Date].[Calendar].[Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( StrToMember ("[Date].[Calendar].[Month].&[2015-04-01T00:00:00]" ) ) ON COLUMNS FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    --This query will give you the date without lag
    SELECT NON EMPTY { [Measures].[Completes] } ON COLUMNS, StrToMember
    ("[Date].[Calendar].[Month].&[" + format(now(),"yyyy-MM") +  "-01T00:00:00]" )  on rows FROM [Data Warehouse]) 
    Richard

  • Help with Setting Previous Month Date Parameter for SSAS via SSRS

    Hi All,
    Firstly, any assitance is greatly appreciated.
    Now, I am working on developing a report for a business area that will be sent on the first of every month. The report will contain data for all records created in the previous month, current year.
    I have been able to successfully implement a default year parameter, which will default to current year-
    ="[REFERRAL LODGEMENT DATE].[CAL YEAR].&["+CSTR(Year(Today))+"]". However, when I attempt to set a previous month paramater it is not setting when the report is generated. The code I have used
    is as follows: 
    ="[REFERRAL LODGEMENT DATE].[CAL MONTH NAME].&["+CSTR(Month(Today)-1)+"]"
    Cheers

    Before you spend more time trying to fix the parameter, let me suggest that you can write MDX to come up previous month data.
    if you can't go that route, couple of things to consider for your approach:
    1) don't subtract 1 from January that won't work. you'll need to handle it using the ssrs expression.
    2) when you use the month function it's going to return a month index so effectively you are passing something like [REFERRAL LODGEMENT DATE].[CAL MONTH NAME].&[7] to SSAS, is that the current format?
    you can use the MonthName function to get month names but again make sure that the formatting is right.
    to see the parameter value, you can display it on the ssrs report and see if it's the right format.
    Paras Doshi (Blog: ParasDoshi.com | Twitter:
    @Paras_Doshi )

  • I brought  I pad air 3 months ago, but recently I can't install any application and can't make an update. Even I can't install the free application. I can see ... There is a previous purchase problem please Singh up your bank information again. Plz help

    Hi , I brought an I pad air 3 months ago. But recently I can't install any application and can't update any application. Even I can't install any free application. I can see one dialogue box about in red colors " there is a previous purchase problem please type your bank information correctly" . So I don't know what to do please help me. Thanks

    The message implies that a previous purchase may not have been paid-for due to problems collecting the money from your account. Have you tried logging into your account and updating/changing your payment details (tap on your in Settings > iTunes & App Store on your iPad and tap 'view Apple id' on the popup and sign into it) ? Until there is an accepted payment method on your account (credit card, redeemed iTunes gift cards) and what you owe has been paid then you won't be able to download anything (including app updates).

  • P & L report for current period,YTD and previous YTD

    I am trying to create a P & L report with the columns for current period,YTD and previous YTD,  I have include the measures as the key of columns, which by using period or YTD we can retrieve the current period and YTD column, is there as easy way to get the previous YTD? although I can get it  by using evtim to het every month and calculate the previous YTD.

    resolved, just need to bring both time and measures in the columns

Maybe you are looking for

  • Problem with windows 8.1 installation ?

    hi,got my windows 8.1 on usb flash drive & tried to install through bootcamp and got disk fail when restart ? any ideas have i done something wrong in bootcamp ?

  • How can I print a text message conversation from my iPhone? Not using screenshots.

    How can I print a text message conversation from my iPhone? Not using screenshots. It's around 500 messages so screenshots is not a option.

  • Transform XML in TEXT

    Hello, can anyone help me? I want to transform an XML-Document to Text-Document. I would store the data of this text-document in a MySql-Database. Can you tell me if the is a possibility to do all this with java. It's possible only with XSLT and how?

  • Problem with ABBYY FineReader or Adobe?

    Dear all, A large number of our customers send us their texts in PDF format. Some of these texts can not be saved as a Word file, hence we process them through ABBYY FineReader 9.0 Professional Edition. Somehow the word count (often that is the way t

  • BIOS doesn't detect HD but system still boots - then hangs while working

    Daughter brought her HP DV9500 (Vista SP2 32bit) home. Very suspicious of malware. If I check the BIOS, it does not see the hard drive (nor does that option appear in the boot menu). However, if you boot the machine, it will load Vista and allow you