Prior function in MDX

HI,
I am converting an BSO to ASO so need to change the Member furmula in MDX. I need to to change the following Prior function to MDX:
@PRIOR( "Measure1" -> "EOPTIME" -> "DCAP001", 12, @LEVMBRS ("DLOS014", 0))
my doubts are:
1. How to use cross dimension in Prior function as comma (,) but it will take as an argument in function and even i cann't use braces also.
2. in MDX we can't use range in lag function. so how to use range in lag function in MDX or any other approach?
Thanks in advance.
Regards,
Abhishek

to do the prior, you would use the lag function. It looks like you are lagging back 12 periods so you would have to add the periods dimension into the touple.
To get the members you would use a tuple which would be something like ( [Measure1],[EOPTIME],[DCAP001],[Periods].currentmember.lag(12))
Put that inside a case statment like Case When ISleaf([DLOS014].currentmember) then

Similar Messages

  • Use variables in ParallePeriod function in MDX

    Hello, I am using PARALLELPERIOD () function in MDX. the syntax is
    PARALLELPERIOD([Date].[Calendar Hierarchy].[Year],1,[Date].[Calendar Hierarchy].[Date].&[20131201]). My question is can i use two variables in this? like PARALLELPERIOD( @Level,1,@Member). I know we can do PARALLELPERIOD([Date].[Calendar Hierarchy].[Year],1,@Member).
    With this two variables, i can use same query for calendar hierarchy and week hierarchy etc. Please let me know your thoughts. A work around solution is also fine.
    or can I derive @level from @member on the fly? something like PARALLELPERIOD( @Member.level,1,@Member)
    thanks in advance.
    prajwal kumar potula

    You can use variables like that client side.  That may be a .NET function that generates MDX, or SSRS does the same thing.
    Regarding whether you can derive @Level from @Member, yes you can.  Once you have substituted @Member in the query, you can use the .Level function, so it would look like this - after substitution:
    PARALLELPERIOD( [Date].[Calendar Hierarchy].[Date].&[20131201].Level,
    1,
    [Date].[Calendar Hierarchy].[Date].&[20131201]
    Christian Wade
    http://christianwade.wordpress.com/
    Please mark correct responses as answers!

  • Help with @Prior function

    Hi,
    I have a requirement for member formula = (Forecast for CurMth - Actuals for CurMth) + (Forecast for PrevMth - Actuals for CurMth) / (Actuals for CurMth - Actuals for PrevMth)
    I am using the Prior function for this shown as below
    ( ( @PRIOR ("Monday Forecast",0,@CurrMbr("Periods")) - @PRIOR ("Actuals",0,@CurrMbr("Periods")) ) + ( @PRIOR ("Monday Forecast",1,@CurrMbr("Periods")) - @PRIOR ("Actuals",1,@CurrMbr("Periods")) ) ) / ( @PRIOR ("Actuals",0,@CurrMbr("Periods")) - @PRIOR ("Actuals",1,@CurrMbr("Periods")) ) ;
    I see that @ Prior function is not getting the values for the prev month scenario members. Any help would be appreciated guys.
    Thanks.

    Unless I have totally misunderstood your requirement, you are making this much more difficult than it needs to be!
    I would suggest the following steps...
    1. Read the Technical Reference entry for @PRIOR
    2. Get rid of all those @CURRMBR("Periods") specified as the range across which @PRIOR will operate (the third parameter). The range is an optional parameter which doesn't need to be specified if Periods is tagged as a Time dimension, and in any case, having a single member there is meaningless
    3. Don't use @PRIOR with zero specified as the offset - think carefully about what that means. You don't need @PRIOR at all to refer to anything in 'current month'
    Good luck!

  • @PRIOR function question

    hi all, please explain me use of @prior(member, offset, range list) function
    as I understand here:
    member - a single member we want to return value of
    offset - number of periods/some_members of range list
    range list - members for offset choose
    says, we have accounts
    acc0
    acc1
    acc2
    how should I define formula with @PRIOR function if I want calculate:
    1) acc2=acc1 of previous N months, where N is stored in acc0
    2) acc2=acc2 of previous N months, where N is stored in acc2 in custom_member2 of custom_dimension2

    Hi,
    Your question is a little hard to understand, so I will try to help by posting some information about the @PRIOR function and hoping it gets you moving.
    It's important to remember that @PRIOR returns a numeric value. It's not a memberset function used to navigate the hierarchy. It's a function used to select one value from a set of values.
    Typically, you just use it to step one month back in time and get the value of some account for use in the current month, like this:
    "BegBalance" = @PRIOR("EndBalance");
    What you don't see here is that this is taking advantage of the default values for the second and third arguments (the number of steps to go back, and the memberset to walk back through). The defaults are 1, and the-level-0-members-of-your-time-dimension.
    Because I hate duplicating code in multiple fixes, specifying years in IF statements, and year-end maintenance, I tend to do something like this...
    IF (@ISMBR("Jan"))
    "BegBalance" = @PRIOR("EndBalance"->"Dec", 1, @LEVMBRS("Year", 0)); /*Note that you can cross-dim in the first argument*/
    ELSE
    "BegBalance" = @PRIOR("EndBalance");
    ENDIF;
    This is a good way to fix up code you inherit from consultants who only have to make things work in dev, don't mind nesting IF's and doing a bunch of double cross-dims to get from Jan to Dec, and are going to be long gone by the time the year rolls over. I'm sorry... have I gone off-topic?
    The point is that you can use @PRIOR to pull numbers from elsewhere in the database, if you know what memberset you need to walk back through and how far back you need to walk. I presume you can use your acct0 as the second argument, since it's numeric, but you'll have to test that to see. You can also walk forward with @NEXT, if that helps you any.
    Hoping you can find an answer in there somewhere,
    -- Joe

  • @Prior Function delleting entire data

    Hi,
    I have written a simple script using @Prior function which has to take the value of the previous month.
    Ex- X= @PRIOR(X)
    And i have saved the data for Mar month for X and ran the script. My April Month and other months should get calculated accordingly.
    But after the execution of the script my Mar data is also getting deleted.

    Hi,
    Although you have not provided much information, just for starters - Do you have any data in Feb? If not, that is the reason for Mar getting deleted.
    If you need to run this script for Monhs after Mar, refriuct your calc script rage using FIX(Apr:Dec)
    Cheers
    RS

  • Calculating Qtr2 with @PRIORS function

    Hi all,
    I am trying to calculate Qtr2 with @PRIORS function.
    The following script works: @PRIORS(SKIPMISSING, "Jun");
    Here is my issue:
    This logic will fail if there is no data in Apr, May or Jun. It will keep looking for the previous period with data, which could be Mar. And this would be a wrong value.
    Therefore, I would like to come up with a rangelist, just like the Tech Ref suggests: http://docs.oracle.com/cd/E17236_01/epm.1112/esb_tech_ref/priors.html
    The following script does not work: @PRIORS(SKIPMISSING, "Jun", "Apr":"Jun");
    This doesn't work either: @PRIORS(SKIPMISSING, "Jun", "Apr","May","Jun");
    Any ideas?
    Thanks,
    Mehmet
    p.s. We are on version 11.1.2.1

    Hi Mehmet,
    If I understand you correctly, Jun data should be #mi if both Apr and May are #MI, and if May is #mi, but Apr is 100, then prior jun should be 100.
    IF (Apr > 0)
    @PRIORS(SKIPMISSING, "Jun");
    ELSE
    @PRIORS(SKIPNONE, "Jun");
    ENDIF;
    Regards,
    Robb Salzmann

  • Disabling 'Delete Prior' function

    Hi -- I'm curious if there's a way to disable the 'Delete Prior' function.  It is physically very close to the 'Mark Prior Read' 'button' which I use frequently and I am afraid of deleting all of my prior emails again.  It happened once by accident and my emails were instantly permanently deleted from both my Q10 and Outlook on my laptop.  Very frustrating.
    When deleting a single email, an option appears asking if I want to delete the email from the Hub or from the Hub and Server but the 'Delete Prior' function only warns me of deleting the messages and doesn't provide the Hub / Server option.
    Thank you in advance for any insights provided.

    That's a core feature built right in to the OS therefore there's no getting around it.
    Cheers.  
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • How to use a @PRIOR function with a SubVar in a cross dim formula?

    Hi all,
    I have a pretty basic logic to calculate a member:
    Rate = Account1->Entity->Prior Forecast Year / (Account2->Entity->Prior Forecast Year + Account3->Entity->Prior Forecast Year);
    We have a SubVar for the Current Forecast Year, so in my formula I wanted to use @PRIOR(&CurFstYr)
    I got an error message: expected type [MEMBER] found [NUMBER] ([@PRIOR]) in function []
    The calc validates and runs with no errors if I use &CurFstYr only, which gives me the option to create a Prior Forecast Year subvar: &PriorFstYr. Is this my only option?
    I've also tried using SUMRANGE function. The formula validated for @PRIOR(&CurFstYr). Eventhough the calc script validated, the calc stopped after 3 seconds with the below error message:
    Error executing formula for [Rate] (line 0): invalid object type
    Any idea why the SUMRANGE calc failed to run? Also, once again, is my only option to create a new SubVar for the Prior Forecast Year?
    Thanks,
    Mehmet
    Edited by: Mehmet Sevinc on Mar 2, 2012 12:14 PM
    Edited by: Mehmet Sevinc on Mar 2, 2012 12:29 PM

    You have this:
    Rate = Account1->Entity->Prior Forecast Year / (Account2->Entity->Prior Forecast Year + Account3->Entity->Prior Forecast Year);I don't have Essbase fired up, but I wonder if this would work:
    Rate = @PRIOR(Account1->Entity->&CurFstYr, 1, "Years") / (@PRIOR(Account2->Entity->&CurFstYr, 1, "Years") + @PRIOR(Account3->Entity->&CurFstYr, 1, "Years")) ;You can put a cross dim into a @PRIOR statement, but you will need to specify the dimension unless it's whatever is tagged as Time. My guess is Years is not the Time dimension.
    I'll bet the @PRIOR doesn't make things fast.
    Regards,
    Cameron Lackpour
    Edited by: CL on Mar 2, 2012 6:26 PM
    Forgot the first @PRIOR

  • Error "Members, tuples or sets must use the same hierarchies in the function" in MDX

    the following MDX returns error: "Members, tuples or sets must use the same hierarchies in the function"
    WITH
    MEMBER [Measures].[Prev Year] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Year].Levels('Year'),
    1,
    [Exec Date].[Year].CURRENTMEMBER
    MEMBER [Measures].[Prev Month] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Month Num].Levels('Month Num'),
    1,
    [Exec Date].[Month Num].CURRENTMEMBER
    MEMBER [Measures].[Prev Day] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Day].Levels('Day'),
    1,
    [Exec Date].[Day].CURRENTMEMBER
    SELECT NON EMPTY { StrToMember("@ExecDateLevel"), [Measures].[returns] } ON COLUMNS, NON EMPTY { ([Employees].[Company].[Company].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (
    SELECT (
    STRTOSET(@ExecDateHierarchy, CONSTRAINED)
    ) ON COLUMNS FROM [cbSales]) WHERE ( IIF( STRTOSET(@ExecDateHierarchy, CONSTRAINED).Count = 1, STRTOSET(@ExecDateHierarchy, CONSTRAINED), [Exec Date].[Hierarchy].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
    and when I replace "StrToMember(@ExecDateLevel)" with
    StrToMember("[Measures].[Prev Month]") the MDX is compiled correctly.
    what is the problem?
    How can I solve that?

    Hi Breceive,
    In your scenario, the issue is caused by that you select dimension members and measures on the same axis without a crossjoin.
    SELECT NON EMPTY {  StrToMember("@ExecDateLevel"), [Measures].[returns] } ON COLUMNS
    To avoid this issue, you can use the query below.
    WITH
    MEMBER [Measures].[Prev Year] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Year].Levels('Year'),
    1,
    [Exec Date].[Year].CURRENTMEMBER
    MEMBER [Measures].[Prev Month] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Month Num].Levels('Month Num'),
    1,
    [Exec Date].[Month Num].CURRENTMEMBER
    MEMBER [Measures].[Prev Day] AS
    [Measures].[returns],
    PARALLELPERIOD
    [Exec Date].[Day].Levels('Day'),
    1,
    [Exec Date].[Day].CURRENTMEMBER
    SELECT NON EMPTY { StrToMember("@ExecDateLevel")*[Measures].[returns] } ON COLUMNS, NON EMPTY { ([Employees].[Company].[Company].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (
    SELECT (
    STRTOSET(@ExecDateHierarchy, CONSTRAINED)
    ) ON COLUMNS FROM [cbSales]) WHERE ( IIF( STRTOSET(@ExecDateHierarchy, CONSTRAINED).Count = 1, STRTOSET(@ExecDateHierarchy, CONSTRAINED), [Exec Date].[Hierarchy].currentmember ) ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
    Here is a similar thread for you reference.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/3c21d9a8-640d-4dde-bc76-08d1fcbb3a31/multiple-dimension-query?forum=sqlanalysisservices
    Regards,
    Charlie Liao
    TechNet Community Support

  • Using Rank function in mdx

    I have the following data in my cube
    Prod ID  Account ID     Measure
    1            10                    20
    2            10                    20
    2            20                    10
    Now I want an mdx query which would show an aggregation against the Account ID 10 as 20 only and not 40 as the Account ID is the same which means the desired output has to be something like
    Account ID  Measure
    10                20
    20                10
    Note that Prod ID and Account ID are from different Dimensions.
    Please let me know how do I do this in MDX. Any help is greatly appreciated!!

    Hi N
    Another option is to use the Generate function and just take the last Prod Id for each Account.  Your MDX will look something like
    select non empty 
    {[Measures].[MyMeasure]
    } on 0, 
    non empty  
    generate([Account ID].[Account ID].[Account ID].members
    ,tail(nonempty([Prod ID].Prod ID].Prod ID]*[Account ID].[Account ID].currentmember,[Measures].[MyMeasure]),1))
    on 1
    from MyCube 
    Richard

  • Non Empty function in MDX with IIF command

    Hi All ,
    I have a MDX query like:
    IIF(isgeneration([YEAR].CurrentMember, 2),
    iif(isgeneration([TIME].CurrentMember, 4),
    parallelperiod(YEAR.generations(2), 1, [YEAR].currentmember),
    missing
    missing
    Now if I'm trying to write NON EMPTY function like:
    IIF(isgeneration([YEAR].CurrentMember, 2),
    iif(isgeneration([TIME].CurrentMember, 4),
    +NON EMPTY(parallelperiod(YEAR.generations(2), 1, [YEAR].currentmember))+,
    missing
    missing
    then it gives me syntax error.
    Can you please help me how to write NON EMPTY function with IIF statement
    Thanks in advance

    Hi All,
    Any help Please. I'm getting error not only within IIF statement but also in simple MDX query. As a example :
    NonEmptySubset(
    ([Total Rev Measure], time.currentmember)
    This also thrown syntax error. I have tried Non Empty also.

  • Filter Function in MDX statement

    Hi Experts,
    I have a question on MDX, i hope this is the right place to post.
    I want to exclude a certain value of an infoobject in MDX output. How can i achieve this?

    Though not recommended for huge sets - are you not able to use things like not equal or not in list in your query filters?
    Anyways google " OLAP universes best practices" - its a good document

  • Passing results to another function in MDX

    I'm pretty sure I know the answer to this, but it would be cool if it worked, so I figured I would put it out there and see if anyone successfully did this.<BR><BR>Is it possible to pass the result of a function NonEmptyCount() as an index for another function Item()?<BR><BR>Example<BR>CrossJoin({[Time].Levels(0).members},<BR>{[Measures].[Headcount]}).Item(NonEmptyCount(<BR>[Time].Levels(0).members, [Measures].[Headcount]<BR>))

    I found the solution to my problem.
    [1] Create a "After Submit" under Computations.
    [2] Select 'Item Value' under Type in Item Name
    [3] Select "After Submit" under Computation Point
    [3] Enterer Item Name, which value needs to be passed in 'Source'
    thanks

  • SCOPE Function in MDX

    HI All,
    I have a very basic doubt in SCOPE function.
    We have a new calculated measure called CustomCalculation.
    The expression that I have used for this measure is :
    SCOPE ([Measures].[CustomCalculation]);
    THIS = ([Gender].&[Male],[Measures].[TotalPopulation]);
    END SCOPE;
    Here, the calculation is giving me the correct value,  but below are my questions:
    1- When we simply drag the new calculated measure, it gives NULL
    2- When we drag any other dimension apart from Gender, it gives NULL
    3-It only shows value when we drag Gender dimension, in the presence of Gender dimension it will show the correct value for other dimensions also, but as soon as I remove Gender dimension it will show NULL for every other objects.
    Is this the intended behavior of SCOPE function or I am doing any wrong thing.
    Thanks
    Sudipta Ghosh
    Sudipta Ghosh Tata Consultancy Services

    Hi Sudipta ,
    Since your Scope will create always the (Male,TotalPopulation) tuple, it should show values for Male only .
    Let's say we dragged the Female member . We will expect to get no data back cause only the Male member is used in the calculation .
    Guessing the default member is something like [gender].[gender].[All] can be the explanation for your questions .. Change the 'DefaultMember' property of the gender attribute to [Gender].&[Male] to overcome the issue OR you can create an All genders
    scope for the All member calculation :
    Scope([Measures].[CustomCaculation], [gender].[gender].[All] );
    This= Aggregate([gender].[gender].[gender] , [Measures].[CustomCaculation]) ;
    End Scope ;
    Hope it helps :)
    Regards, David .

  • Using String Functions In MDX

    I am trying to modify an object in a universe built on BW using MDX.  The object is [ZCALDAY2].[NAME]. The object brings back a list of dates yyyymmdd.  I would like it to only bring back yyyymm ( and distinct values only).  Is this possible?
    I have tried <EXPRESSION>MID([ZCALDAY2].[NAME],1,6)</EXPRESSION> - no luck!  Any help would be appreciated
    Thanks
    Tom

    Not supported in BW

Maybe you are looking for

  • GRN Problem

    Hi Gurus While posting GRN for document type PO- Capital Imported message occured Purchase order 4200000211 has no items. Pl suggest on this Manoj

  • Htmlb:fileUpload = page connot be displayed

    I just tried to use a this item: <htmlb:fileUpload id="att_upload" size = "50" /> However, as soon as I instert that item into my BSP page and try to start it (F8), i get an "page connot be displayed" error in the browser. does anybody know how to us

  • Fuzzy output when I convert mp3 to aac (to make audiobook)

    That's pretty much it. I have imported CDs of audio books that I want to put on my iphone. I am converting the mp3s to AAC - then changing the extension from mp4a to mp4b so that it is filed in the audio book section. But during the conversion the qu

  • How do I delete a column for just one table and not all the others?

    I have multiple tabels in a Pages document. I want to delete some columns on some of the tables but keep them on the other tables. When I delete the columns it deletes all of them on all of the tabels and I dont want that.

  • IBooks only imports PDFs when it wants to

    Hi, With a PDF file on my e-mail, I hit open in iBooks and 1 of 3 things happen: (1) The file is imported to the PDFs Folder of iBooks (2) The file flashes temporarily in the PDF Folder but DOES NOT import (3) iBook opens but the file DOES NOT transf