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!

Similar Messages

  • Unable to use variables of a function module in am enhancement spot

    Hi All,
    I have created an implicit code enhancement spot at the end of a function module. In this enhancement I am unable to access the local variables and the import/export variables of the function module. Is this the expected behavior or I am doing something wrong.
    Thansk & Regards,
    Saurabh

    Hi Saurabh,
    Can you explain your scenario in detail with tcode and function module and all.
    Regards,
    kamalapriya

  • Using variable in NScript

    I'm trying to set SName to the username, then get the volumes
    restrictions based on the variable SName, which is set to the username.
    How do you use variables in NScript functions?
    here is the statement taht errors:
    Set restr = RestrictionsObj.Element (SName)
    If I use Set restr = RestrictionsObj.Element ("Specific UserName") it
    works.
    such as Set restr = RestrictionsObj.Element ("Student1") it works.
    On Error Resume Next
    Dim SName
    Set nwdir=CreateObject("UCX:NWDIR")
    'Enter the username and password
    nwdir.Login (".username.context", "password")
    Set volmgr = CreateObject ("UCX:VolumeMgr")
    Set volumes = volmgr.volumes
    Set volume = Volumes.Element("Docs")
    'Enter the NDS context
    nwdir.Fullname = "NDS:\\TREE\context"
    Set entries = nwdir.Entries
    Print "Total number of entries: "&Entries.Count
    Entries.Reset()
    While Entries.HasMoreElements()
    Set Entry = Entries.Next()
    Print Entry.ShortName
    Set SName = Entry.ShortName
    Print SName
    'Note: Name prints twice here just like it should
    If (Err.Number = 0) then
    Set RestrictionsObj = volume.GetSpaceRestriction ()
    If (Err.Number = 0) then
    Set restr = RestrictionsObj.Element (SName) 'Fails here
    If (Err.Number = 0) then
    Print "The restriction volume limit for " & restr.Name & " is
    " & restr.VolumeLimit
    Else
    Print("Failed to find restriction for the specified user " &
    Err.Description )
    Endif
    Else
    Print ("Failed to get restrictions object " &
    Err.Description)
    Endif
    Else
    Print ("Failed to find the volume " & Err.Description)
    Endif
    Wend
    sgdought

    sgdought,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at
    http://support.novell.com.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://support.novell.com/forums)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://support.novell.com/forums/faq_general.html
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • 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

  • Using variables in a button function

    I am new to AS3 and building a simple flash banner. There
    will be four movie clips consisting of just one word each (in the
    sample below I'm just using rectangle for now). When moused over
    each word will show a rectangle with a message in it, like a large
    tool tip. I have a rudimentary version working fine, see code
    below.
    Question 1: Is there a way to just write on function which
    will work with all four buttons changing the message, say using
    variables like AS2?
    Question 2: Does the code below look relatively efficient?
    I'm sure there are better ways to write it.
    Here's a link to the rudimentary version,
    http://www.rivergraphics.net/tests/button3.html,
    that should give you an idea of what I'm trying to do.
    Thanks.

    Simply use the information that's passed along with the event
    to figure out which item raised the event. Then you can easily call
    the other items that correspond to the button raising the event.
    TS

  • How to use session variable in JSP function  & How to use both JSP  Servlet

    Hi,
    I am new to JSP and servlets
    Still I am devloping a website in JSP. I am not mixing JSP with servlets, but I do create Java files for bean, logic and database works.
    I try to keep the hard coding part out of JSP.
    I dont how to use both JSP and Servlets in combination.
    Hence If needed I write some functions in JSP.
    but it gives me error
    +<%! public void abc()+
    +{+
    int intUserId = Integer.valueOf((Integer) session.getAttribute("MySession_UserID"));
    +}+
    +%>+
    Saying cannot find symbol session
    1) So can u please tell how can I access session variables within JSP function
    2) And also give me some links/tutorials about useing both JSP and Servlets in combination.
    Thanks
    Venkat

    The application architecture when you use Servlets and JSP in a standard MVC pattern is explained here (under the heading "Integrating Servlets and JSP Pages") and here ...

  • Using a global variable within a function

    Hi all,
    I'm trying to learn how to use global variables, but can't quite get it right:
    Im trying to use two buttons, named UpButton and DownButton to control one global variable, p1
    A text field, named "Value" displays p1.
    Here's my code:
    p1 = 0;
    ButtonClick("UpButton", p1, 100,"Value");
    ButtonClick("DownButton", p1,(-100),"Value");
    function ButtonClick(ButtonName,Var,Increment,TextToChange){
                        sym.$(ButtonName).click(function(){
                        Var = Var + Increment;
                        sym.$(TextToChange).html(Var);
    However, it seems to be treating p1 as two different variables.
    Here's a link to the page to show you what I mean, apologies but this link wont work in google chrome because I'm using dropbox as a server temporarily
    In other browsers you may need to click "Show all content" or similar to any security warnings...
    https://dl.dropboxusercontent.com/u/83693404/ButtonTest/buttons.html
    Here are the project files:
    https://app.box.com/s/0shocivto8fl295h62uq
    Any help greatly appreciated, sorry if this is a stupid question,
    Katherine

    Hi Katherine,
    However, it seems to be treating p1 as two different variables.
    Indeed, your code created two different variables in two different scopes (I guess it as to do with JavaScript closures, but do  not ask me more, I am still a bit foggy about that idiosyncrasy ).
    In JavaScript, a primitive parameter – this is the case here with p1, a Number value –, is passed by value. In other words, a copy of the value is made. Your code handles two copies of the value stored in p1.
    This contrasts with an object parameter, which is passed by reference (address in memory), without copy. Your code would work if Numbers were passed by reference : the two Var (p1) would then point to the same address.
    The intent behind your trial is a global variable.
    1) Let us be as simple as possible :
    Stage : document.compositionReady event handler
    p1 = 0;
    buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    Stage : DownButton.click event handler
    buttonClick(-100);
    Stage : UpButton.click event handler
    buttonClick(100);
    Without being preceded by the var keyword the variables are global.
    So the Number variable p1 can be accessed inside function buttonClick.
    And the Function variable buttonClick as well, is accessible inside click event handlers, everything (function definition +function calls) being inside the same symbol (Stage).
    2) Now, suppose this is no longer the case : you want to access a variable from another symbol.
    We create a new GraySquare symbol, instantiated both in the DownButton symbol (instance name DownSquare) and in the UpButton symbol (instance name DownSquare).
    Stage : document.compositionReady event handler
    p1 = 0;
    sym.buttonClick = function( Increment)
      p1 += Increment;
      sym.$( "Value").html( p1);
    The sym. prefix is now necessary to make the variable (here a Function, but you would proceed exactly the same with a String, Number or Boolean) accessible in other symbols.
    DownButton symbol : DownSquare.click event handler
    sym.getComposition().getStage().buttonClick( -100);
    UpButton symbol : UpSquare.click event handler
    sym.getComposition().getStage().buttonClick( 100);
    From these other symbols, the sym.getComposition().getStage(). prefix is necessary to acces to our global variable (function).
    The two examples are downloadable here : https://app.box.com/s/6vkyiqk7i8zwlw0j1wk1
    Gil

  • Using variable coulmn name in sql function

    Hi there,
    I am not an expert with PL/SQL and I can not figure out how to use variable column names in my function.
    My function is:
    CREATE OR REPLACE FUNCTION RESET_TRIGGERS(aTrigger VARCHAR2) RETURN NUMBER IS
    TEMP_ID NUMBER;
    TEMP_USER_ID NUMBER;
    BEGIN
    SELECT 'LIMS.'||'$aTrigger'||'.NEXTVAL' INTO TEMP_ID FROM DUAL;
    SELECT 'LIMS.'||'$aTrigger'||'_USER.NEXTVAL' INTO TEMP_USER_ID FROM DUAL;
    IF TEMP_ID > TEMP_USER_ID THEN
    LOOP
    SELECT LIMS.SQ_U_FINALRESULT_USER.NEXTVAL INTO TEMP_USER_ID FROM DUAL;
    EXIT WHEN TEMP_USER_ID = TEMP_ID;
    END LOOP;
    ELSE
    WHILE TEMP_ID < TEMP_USER_ID LOOP
    SELECT LIMS.SQ_U_FINALRESULT.NEXTVAL INTO TEMP_ID FROM DUAL;
    END LOOP;
    END IF;
    COMMIT;
    RETURN (TEMP_ID);
    END;
    What I want is that I pass a seqencename with aTrigger and that two triggers will be equal if not.
    eg ifaTrigger = 'SQ_U_FINALRESULT'
    than I want the triggers LIMS.SQ_U_FINALRESULT and LIMS.SQ_U_FINALRESULT_USER to be set equal.
    The above function will not work, but what will?????
    I hope you can help me out!
    Cheers

    A very strange function indeed.
    But here is what I think he meant to do:
    SQL> create procedure reset_sequences
      2  ( p_sequence_name in  varchar2
      3  , p_nextval          out number
      4  )
      5  is
      6    l_nextval1 number;
      7    l_nextval2 number
      8    ;
      9    procedure reset_sequence_value
    10    ( p_sequence_name in varchar2
    11    , p_current_value in number
    12    , p_new_value     in number
    13    )
    14    is
    15      l_dummy number;
    16    begin
    17      execute immediate 'alter sequence ' || p_sequence_name || ' increment by ' || to_char(p_new_value-p_current_value);
    18      execute immediate 'select ' || p_sequence_name || '.nextval from dual' into l_dummy;
    19      execute immediate 'alter sequence ' || p_sequence_name || ' increment by 1';
    20    end reset_sequence_value
    21    ;
    22  begin
    23    execute immediate
    24      'select ' || p_sequence_name || '.nextval,' || p_sequence_name || '_user.nextval from dual'
    25    into l_nextval1, l_nextval2
    26    ;
    27    if l_nextval1 < l_nextval2
    28    then
    29      reset_sequence_value(p_sequence_name,l_nextval1,l_nextval2);
    30    end if
    31    ;
    32    if l_nextval1 > l_nextval2
    33    then
    34      reset_sequence_value(p_sequence_name || '_user',l_nextval2,l_nextval1);
    35    end if
    36    ;
    37    p_nextval := greatest(l_nextval1,l_nextval2)
    38    ;
    39  end reset_sequences;
    40  /
    Procedure is aangemaakt.
    SQL> show err
    Er zijn geen fouten.
    SQL> create sequence testseq start with 5 increment by 1
      2  /
    Reeks is aangemaakt.
    SQL> create sequence testseq_user start with 2 increment by 1
      2  /
    Reeks is aangemaakt.
    SQL> declare
      2    l_new_value number;
      3  begin
      4    reset_sequences('testseq',l_new_value);
      5    dbms_output.put_line(l_new_value);
      6  end;
      7  /
    5
    PL/SQL-procedure is geslaagd.
    SQL> select testseq.currval from dual
      2  /
                                   CURRVAL
                                         5
    1 rij is geselecteerd.
    SQL> select testseq_user.currval from dual
      2  /
                                   CURRVAL
                                         5
    1 rij is geselecteerd.Regards,
    Rob.

  • Using variable in function for FLASH video

    I have a webpage that uses PHP to pull a variable from a
    MySQL database.
    I would like to use that variable to tell my flash component
    what flash video to play. I cant seem to figure out how to place
    the variable in the function call to make it work.
    Also...The main page is in the root directory of my site with
    all my flash videos in a subfolder. I can't seem to get the videos
    to play on my main page unless they are in the same directory. I
    even tried to simply 'include' the movie into my existing page and
    it doesn't work.
    Any idea on either of these issues?
    (Is this even the correct forum area for this? I am new to
    using FLASH for this stuff)

    Thanks for the advice!
    Turns out I believe my answer lies in PHP, but I will check
    out the LoadVars help in FLASH too!
    Andrew

  • Repost Function using Variable is not working

    Hello experts!  I am on BW-BPS 3.5.  I have set up a repost function using variables to change a characteristic value for Business Unit.
    1. I created 2 variables as Bus.Unit From and Bus.Unit To in the Planning Area. I am not using the variables in my planning level.
    2. I entered the variables in the parameter group New Values area for the From and To Values.
    3. My goal is when the user executes the Repost Function for a Variable Prompt should appear and have the user select the From Business Unit and To Business Unit.
    The Variables are set up as USERVALUE User-Defined Values, Restriction of Values required by user and I have tried with/without option of Input Allowed by User. 
    Can you tell me what I am doing wrong, I expected a variable prompt when executing the Repost Function but it does not work.
    Thank you,
    Teri

    Ravi, Thank you for your reply however I contiue to have errors or the execution does not repost (change any value) as noted below.
    1. I have 2 Variables in Planning area var1 (from) var2 (to) for the same charateristic which is Business Unit
    2. Business Unit is in the level,  on the selection tab to add the variable I can only add 1 variable, So I added var1 (from) to the level. 
    3. Parameter group for old and new values - I have Var1 (from), var2 (to)
    4. Report Function - are you referring to Reporting variables in BPS? I have set this up as suggested in the "How to Use Reporting Variable in BW-BPS" document.
    5. Enter plan data: I receive prompt for VAR1, mandatory. At this point there is no value in Var2.
    6. Execute Repost function - I receive an error to "Restrict Var2"
    7. If I set variable values and add a value for Var2 I receive an error "The generated data is not contained in the selection condition".
    Next I removed VAR1 from my planning level and turned on the option 'Selection in package' for Business Unit. This seems to work well.
    What do you recommend?
    Thank you,
    Teri

  • Can't use bind variable in a function

    This is a repost from my earlier post at
    URGENT: Problem creating the report using Procedure
    The problem is when I bind a variable in a function, I get REP-0002. Please look at the following steps to reproduce
    ===
    set serveroutput on
    create or replace
    package Q_REP_test
    as
    type drec is record
    sdate date
    type dreccursor is ref cursor return drec;
    Procedure Get_sysdate(retdate out dreccursor);
    procedure add_days_tocurdate(no_of_days in number, retdate out dreccursor);
    end q_rep_test;
    show errors
    create or replace
    package body q_rep_Test
    as
    procedure Get_sysdate(retdate out dreccursor)
    is
    begin
    open retdate for
    select sysdate retdate from dual;
    end;
    procedure add_days_tocurdate(no_of_days in number, retdate out dreccursor)
    is
    begin
    open retdate for
    select sysdate+no_of_days retdate from dual;
    end;
    end q_rep_test;
    show errors
    ===
    Invoke the SP as follows:
    ===
    function QR_1RefCurDS return q_rep_test.dreccursor is
    tempc q_rep_test.dreccursor ;
    begin
    q_rep_test.add_days_tocurdate(:p_1,tempc);
    return tempc;
    end;
    ===
    1. Create a report
    2. create an user parameter(p_1)
    3. add a pl/sql as above
    4. run it(to verify the report works)
    5. save it.
    6. close the report
    7. Open it again, you get an as
    "REP-0002: Unable to retrieve a string from the Report Builder Message file". Now it is corrupted and can't be used at all.
    Please treat this as urgent and help me.
    Thanks

    Hi ,
    Though you have stated it as Oracle92iDS check whether it has the 9.0.2.2 patchset applied. If not please try applying the latest Patchset 9.0.2.2 for Oracle9i Reports.
    To download the patch goto Metalink &lt;http://metalink.oracle.com/metalink/plsql/ml2_gui.startup&gt; and search for Patch# 2842923.
    This Patchset is for iAS and iDS.
    In either case, please let me know the results.
    Thanks,
    Vinod.

  • Having trouble with using variables in functions and after functions..

    Morning,
    I have simplified this, as it represents the core of what’s I obviously don't know how to do. 
    Problem:
    Say I populate that variable by reading in a list if IP addresses from file, finding the line that matches the hostname and place that string into the $IPAddress variable for use later throughout the script.   I did not run into a significant problem
    until I decided to convert the routine of looking up the IP address and populating the variable into a function.   As soon as I made it a function, and called that function, the $IPAddress variable only had the data in it until the function completed. 
    Once the function had done its work, and had placed the data into the variable, I expected that “new” data to be available after the function had completed..in that variable.  But it’s like the $IPAddress variable in the main script is a totally
    different data then the variable with the same name that’s used within the function. 
    So I think this demonstrates some of what’s kicking my butt.. 
    $IPAddress = "This is the wrong data”
    Function TestFunction () 
    $IPAddress  #call to display the contents of the variable at the start of the function. 
    $IPAddress = Read-Host -Prompt "Please enter the text ‘Goober’" 
    $IPAddress   #call to display the contents of the variable at the end of the function. 
    TestFunction
    $IPAddress ​
    The output I get is: 
    This is the wrong data
    "Please enter ‘Goober’"  : where I enter Goober
    Goober
    This is the wrong data
    Huh? 
    I had expected:
    This is the wrong data
    "Please enter ‘Goober’"  : where I enter Goober
    Goober
    Goober
    What good is the repeatability of a function if it’s output is lost? 

    THis seems to work.. IS there any reason NOT to do this?
    $Global:IPAddress= "This is the wrong data” #"
    Function TestFunction{
        Write-Host $IPAddress-fore green
          $host.ui.RawUI.FlushInputBuffer()
         $Global:IPAddress =
    Read-Host -Prompt
    "Please enter the text ‘Goober’"
        return$Global:IPAddress
    TestFunction
    return$Global:IPAddress

  • Using Variables in a "Report Custom Functions"

    Hi!
    I created a custom function using Basic Syntax where I am trying to declare/use variables.  I keep getting syntax errors and don't know why.  Here is my code so far:
    Function cdQSIPeriod () As String
    YY = Year(CurrentDate)
    MM = Month(CurrentDate)
    If MM = 1 then
        MM = 12
        YY = YY - 1
    else
        MM = MM - 1
    cdQSIPeriod = String(MM)& String(YY)
    End Function
    Any help you can provide will be appreciated.

    You need to add
    dim YY as number
    dim MM as number
    HTH,
    Carl

  • Using variables for function arguments AS2

      Hello,
    I am trying to create a function in AS2.
    After creating the function, I want to use values stored in variables for the function arguments rather than manually typing static values for carrying out the function calculation. Also, I want to use the function to assign a new value to the existing variable.
    I have asked a similar question 2 days ago here and got the answer (thank you), but now I got one more question - How can I create the function to assign a value to the variable while that variable itself is also a function argument?
    For example, I have 6 numeric variables:
    var CoinA:Number = 10;
    var CoinB:Number = 20;
    var CoinC:Number;
    var CoinD:Number = 30;
    var CoinE:Number = 40;
    var CoinF:Number;
    Then I tried to create a function to assign values to variables CoinC and CoinF:
    function CalculationA(FirstCoin, SecondCoin, ThirdCoin):Void {
         FirstCoin = SecondCoin + ThirdCoin;
    CalculationA(CoinC, CoinA, CoinB);
    CalculationA(CoinF, CoinE, CoinF);
    The above code didn't really assign the values 30 and 70 to the variables CoinC and CoinF but instead, values of CoinC and CoinF are undefined.
    Please give me the correct code if there's a correct way of doing this.
    Thank you,

    Here is one way of doing it, by passing a string value of the variable name instead of the actual variable name....
    var CoinA:Number = 10;
    var CoinB:Number = 20;
    var CoinC:Number;
    var CoinD:Number = 30;
    var CoinE:Number = 40;
    var CoinF:Number;
    function CalculationA(FirstCoin, SecondCoin, ThirdCoin):Void {
         this[FirstCoin] = SecondCoin + ThirdCoin;
    CalculationA("CoinC", CoinA, CoinB);
    CalculationA("CoinF", CoinD, CoinE);
    (Note that in your second function call I changed the coins since CoinF (ThirdCoin) is undefined at that point.)

  • What's user variable name using Smart View POV function (ex:HypGetActiveMember)?

    Hi,
    We want to use Smart View POV function (ex:HypGetActiveMember) to get the active member of user variables from HFM forms selected into Excel, but we don't know the user variable name in the following paragraph of Smart View developer guide:
    "To uniquely identify the user variable, provide the user variable name rather than the dimension name."
    For example, what's the user variable name of Year dimension? How to get the user variable name?
    Any information would be appreciated. Thank you!

    Hi,
    I guess user variable name is set by users/developers. I am not very clear on your question. If you have defined some variables to select any members from a dimension then it will be in HFM only. In planning we have two kinds of variables User Variables (we set it from Planning Preferences) and Substitution variable (we set it from Essbase Consol in the backend). Without looking into your application it is difficult to say the user variable name. Like for Year the user variables can be "PreviousYear", "CurrentYear", or "NextYear" etc.
    Soumya

Maybe you are looking for

  • Install software on multiple client computers in active directory domain win 2008 R2

    We have a Windows Server 2008 R2 Active Directory Domain. We will be getting a few new Windows 7 computers that we will need to install all our proprietary software on, and don't want to have to install all programs, including windows updates, indivi

  • IPhoto change time and date does not work with Flickr

    Hello everyone, In my iPhoto librairies, I do change my photo date and time to set them we they were actually taken. Here, I'm refering especially to photos which are: * scanned photo * stiched photo The issue is: When I share these photo on Flickr,

  • Validation on Transport Request Description

    I want to put some validation on the transport request description. Please let me know the procedure.

  • Need an adaptor

    S-video has discontinued their VGA to ADC adaptor product and I need a solution for connecting an iMac G4 to a studio display. Does anyone know of a source that might permit using a mini VGA to VGA from the video out port chained to such an adaptor?

  • How to add the shipment costs in to material costs

    Dear friends I am implenting the transportation module. In purchase process and STO processes, the client requirement is received material cost should be added with shipment cost. I mean the material cost is 1000/- The shipment cost is 100/- Client R