Converting Calc to MDX

Hi Experts,
I am very new to MDX, hence need help in converting this calc into MDX Query-
If(@ISIDESC("L-206125"))
     "70170023"
EndIF;
Where "L-206125" is from Departments dimension and "70170023" from Accounts. I have this formula on one more Department.
I tried to convert in MDX and got this-
IIF (Is(Departments.CurrentMember,[L-206125]) OR Count(Intersect({Descendants[L-206125]},{Departments.CurrentMember}))= 1)),Accounts.[70170023], #Missing)
But I am getting syntax error whenever I validate this.
Please anyone help me out of this issue?

I took your requirement (sort of) and transferred it to my second favorite Essbase database in the whole wide world, aka, ASOSamp.Sample and, if you'll forgive my my child-like MDX:
CASE WHEN CONTAINS([Geography].Currentmember, Descendants([North East])) THEN
     [Original Price] * -1
ELSE
     42
ENDWorks for me.
So in your case:
CASE WHEN CONTAINS([Departments].Currentmember, Descendants([L-206125])) THEN
     [70170023]
ELSE
     Missing
ENDDo you really want to write Missing to all other intersections, or just the first condition in the CASE? You decide.
Regards,
Cameron Lackpour

Similar Messages

  • Question converting calc to mdx

    &ForecastStart and &ForecastEnd are 2 of my substitution variables in Essbase.
    How to express "&ForecastStart:&ForecastEnd" in mdx formula please? Thanks!

    Hello,
    have a look at this.
    Using Substitution Variables in MDX Queries:
    http://docs.oracle.com/cd/E12825_01/epm.111/esb_dbag/dmaxldml.htm#dmaxldml50380
    Regards,
    Ahmet

  • Statistical calc with MDX question (Mode function as an excel)

    Hi All,
      I need to create an MDX Calc to Returns the most frequently occurring, or repetitive, value in an array or range of data.
      For example, the mode of 2, 3, 3, 5, 7, 10 is 3.
      In Excel I use the MODE() function but I don't know how to do this in MDX and add it as a measure in Universe.
      I can't do the formula in WEBI because we have big data volume and I can't retrieve all the customers in WEBI.
      We have SAP BW 7.0 and SAP BusinessObjects XI 3.1 fix pack 1.3
    Thanks in advance.

    Hi,
    it looks like you created the entry twice so I would suggest you close on of them:
    Statistical calc with MDX question (Mode function as an excel)
    I don't think that those kind of statistical functions are available in MDX. you can always go to se37 and use the bapi_get_functions to see the list of supported functions.
    Ingo

  • Convert SSRS dropdown MDX query to INNER JOIN w/ NONEMPTY? Having hard time with this.

    I'm having an incredibly hard time with this, mostly because I'm very new with MDX.
    I created a simple report (with AdventureWorksDW) whose datasource is an SSAS cube. I select a datekey from the dropdown menu, and the report displays [Measures].[Order Quantity] for that day.
    The problem is that the dropdown displays every single value from the dimdate dimension. DimDate goes from 20050101 to 20201231, so the dropdown is very long.
    How can I alter the SSRS-generated MDX so that it does an INNER JOIN with Fact table and only the dates shown in the dropdown are the ones where there's data in the Fact table?
    Currently, the fact table only has 2 days of data (20141015, 20141016), which means that the dropdown should only display those two dates. I'm including the generated code MDX that populates the dropdown menu:
    WITH MEMBER [Measures].[ParameterCaption] AS
    [Dim Date].[Date Key].CURRENTMEMBER.MEMBER_CAPTION
    MEMBER [Measures].[ParameterValue] AS
    [Dim Date].[Date Key].CURRENTMEMBER.UNIQUENAME
    MEMBER [Measures].[ParameterLevel] AS
    [Dim Date].[Date Key].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption],
    [Measures].[ParameterValue], [Measures].[ParameterLevel]}
    ON COLUMNS , [Dim Date].[Date Key].ALLMEMBERS ON ROWS
    FROM [Adventure Works cube]
    Any help is appreciated.
    VM

    Hi vmhatup,
    you can get rid of blank data using nonempty function and get rid of negative values using filter function nonempty should be inside of filter so it applies first, otherwise it is too slow.
    Your statement could look like this
    WITH MEMBER [Measures].[ParameterCaption] AS
    [Dim Date].[Date Key].CURRENTMEMBER.MEMBER_CAPTION
    MEMBER [Measures].[ParameterValue] AS
    [Dim Date].[Date Key].CURRENTMEMBER.UNIQUENAME
    MEMBER [Measures].[ParameterLevel] AS
    [Dim Date].[Date Key].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption],
    [Measures].[ParameterValue], [Measures].[ParameterLevel]}
    ON COLUMNS
    , filter(
    nonempty([Dim Date].[Date Key].[Date Key],measures.measureName)
    ,measure.measurename >0
    ON ROWS
    FROM [Adventure Works cube]
    Jiri Neoral

  • Convert Formulae into MDX

    <p>Hi,  </p><p>  I am trying to convert Year ending Quarter into MDXequivalent. These are the formulae which has to be converted intoMDX.</p><p> </p><p>YEQ1 = Qtr1 + @MDSHIFT(QTR2, -1, YEARS) + @MDSHIFT(QTR3, -1,YEARS) + @MDSHIFT(QTR4, -1, YEARS)</p><p> </p><p>YEQ2=QTR1+QTR2+@MDSHIFT(QTR3, -1, YEARS) + @MDSHIFT(QTR4, -1,YEARS)</p><p> </p><p>YEQ3=QTR1+ QTR2+QTR3+@MDSHIFT(QTR4, -1, YEARS)</p><p> </p><p>YEQ4= QTR1+QTR2+QTR3+QTR4</p><p> </p><p> Thanks</p><p> </p>

    Probably something like the following (I'm still learning the @ functions):<BR><BR><u>YEQ1:</u><BR>[Qtr1] + ([Qtr2], [Years].PrevMember) <BR>+ ([Qtr3], [Years].PrevMember) + ([Qtr4], [Years].PrevMember)<BR><BR><BR><u>YEQ2:</u><BR>[Qtr1] + [Qtr2]<BR>+ ([Qtr3], [Years].PrevMember) + ([Qtr4], [Years].PrevMember)<BR><BR><u>YEQ3:</u><BR>[Qtr1] + [Qtr2] + [Qtr3] + ([Qtr4], [Years].PrevMember)<BR><BR><u>YEQ4:</u><BR>[Qtr1] + [Qtr2] + [Qtr3] + [Qtr4]<BR><BR>Hope this helps<BR><BR>

  • Converting MDX query into SQL Server 2008

    We have MDX query based OLAP CUbes.
    To reduce MDX based dependenies, we have to convert MDX based cube to sql server 2008 based queries.
    For this I need expert advise to convert below query to sql server 2008 based query :
    CREATE MEMBER CURRENTCUBE.Measures.[Ack Lost]
                        AS 'Sum(PeriodsToDate([Time].[Year], [Time].CurrentMember ), [Measures].[Lost])',
                        FORMAT_STRING = "#,#",
                        VISIBLE = 1;

    Hi Sachin,
    According to your description, you need to convert the MDX query to T-SQL query, right?
    Your MDX query is calculated measure that return the total value from the first sibling and ending with the given member. In T-SQL query we can use the query as Yogisha provided to achieve the same requirement. Now you need to a tool to convert all the MDX
    related SSAS cube queries to MS SQL Server 2008 based queries.
    Although MDX has some similarities with T-SQL these languages are in many ways different. Beginning to learn and comprehend SQL Server Analysis Services (SSAS) MDX queries can be difficult after one has spent years writing queries in T-SQL. Currently, there
    is no such a tool to convert a MDX query to T-SQL query since the structure difference between MDX and T-SQL. So you need to convert them manually, please refer to the links below to see the details.
    http://www.mssqltips.com/sqlservertip/2916/comparison-of-queries-written-in-tsql-and-sql-server-mdx/
    https://sqlmate.wordpress.com/2013/11/12/t-sql-vs-mdx-2/
    http://technet.microsoft.com/en-us/library/aa216779(v=sql.80).aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • URGENT Help: Converting JAVA ALE API (9.3)  to MDX API (11.1.1)

    Hi All,
    currnetly I am in the process of converting ALE to MDX API as ALE is no more used
    com.hyperion.ap.IAPMdMember in ALE Api gives the member details like Alias, level, Gen etc
    Equivalent to IAPMdMember , In MDX there are two
    1.com.essbase.api.metadata.IEssMember -> It gives all the member details like Alias, level, Gen etc
    IEssMember metatdata extraction is very slow. need to increase maxport user as Goodwin said.Even then for 10 lakhs metadata it fails at one point or other (Using outline or member selection every thing fails)
    SEVERE: Cannot get members. Essbase Error(1007165): Cannot obtain new member handle.  The maximum number of open member handles for this outline has been reached.  You must save and close the outline to continue
    2. com.essbase.api.dataquery.IEssMdMember - It gives members Name/alias based on Query setting and some properties like readonly etc.
    This IEssMdMember metadata extraction is very fast. Even 10 lakhs data is retrieved ina minute, but I am in need of Alias, level and Gen to frame the metadat as Nodes (or in bean object with same hierarchy)
    can some Java MDX experts help me.Is there any to access member details like geb, level, alias using IEssMdMember? I searched in API i couldnt find any clue. converting IEssMdMember to IEssMember using outline findmember also time consuming and it taking 2 to 3 days to fetch the 10 lakhs record.
    If there is no way to get details , then give me some tips how it can be managed, by cache technology or threading or is there any fastest collection object available

    Add the below DIMENSION properties in MDX query will provide the Gen_Number, level and alias
    DIMENSION PROPERTIES MEMBER_ALIAS ,GEN_NUMBER ,LEVEL_NUMBER,MEMBER_NAME on columns
    Thanks for http://www.network54.com/Forum/58296/

  • How to convert MDX query to SQL

    Hi everyone,
    can you please suggest me, how to convert the below mdx query to sql query. can you please tell me what it is doing?
    CREATE MEMBER CURRENTCUBE.[Measures].[calculation]
     AS IIF(([Measures].[Clear Call Count],[Trouble Code].[Is Battery].&[Battery T-Code],[Service Provider].[Is Towmark].&[Towmark],[Provider Technician].[Is Towmark].&[Towmark]) = 0, NULL,
    ([Measures].[ Total Shipped],[Service Provider].[Is Towmark].&[Towmark],[Provider Technician].[Is Towmark].&[Towmark])/
    ([Measures].[Clear Call Count],[Trouble Code].[Is Battery].&[Battery T-Code],[Service Provider].[Is Towmark].&[Towmark],[Provider Technician].[Is Towmark].&[Towmark])),
    FORMAT_STRING = "Percent",
    VISIBLE = 1 ,  ASSOCIATED_MEASURE_GROUP = 'Sale'; 
    Thanks
    Vishu

    Hi Vishu,
    As Olaf said, this is a calculated member which used in MDX script in your cube, we cannot execute it in SQL Server Management Studio directly. Here are some document about calculated members and MDX script for your reference.
    Defining Calculated Members
    MDX Scripting Fundamentals (Analysis Services)
    Regards,
    Charlie Liao
    TechNet Community Support

  • Cross Dimension vs FIX

    We are trying to improve calc times by using FIX statements instead of Cross Dimensional statements.We have had success with converting calcs like:"New Prod Dev" = "Total Manufacturing Expense->D904"intoFIX(D904)"New Prod Dev" = "Total Manufacturing Expense";ENDFIXBut we are having trouble with syntax for converting:"Total Sales Exp" = ("Total Manufacturing Expense"->D903)+("Total Manufacturing Expense"->D907)Basically the same statment, but we cannot get the FIX statement to work. Anytime we try to use any additive syntax within the calc and use the FIX it errors. Can't FIX on "Total Manufacturing Expense" because "Total Sales Exp" is from the same dim (account).Any help would be appreciated. Running 5.02 patch 13 a on HP Unix. Migrating next year to 6.5.ThanksGlen MoserConsultant

    You need to be careful - the formulas that you posted are doing two different things. For example, the calculation:FIX(D904) "New Prod Dev" = "Total Manufacturing Expense"; ENDFIX Will work, but its NOT the same as:"New Prod Dev" = "Total Manufacturing Expense"->D904; The FIX basically means that you are moving the "Total Manufacturing Expense" into the "New Prod Dev" for D904 only. The cross dim will take the "Total Manufacturing Expense" for D904 and move it to the "New Prod Dev" for EVERY OTHER D*** member.The second calculation:"Total Sales Exp" = ("Total Manufacturing Expense"->D903)+("Total Manufacturing Expense"->D907) Takes two different member combinations and adds them into "Total Sales Exp" The question is, will this create the right result? If you look at "Total Sales Exp" for D903 it will be the same as the "Total Sales Exp" for D907 - and for EVERY OTHER D*** member. I don't know if that is correct.Unless you are going to change how this formula works or where it gets its value from, you can't use a FIX statement. If the purpose of the FIX is to improve calc time, why not use a member formula and make it Dynamic? Is the result being used in other calculations? Finally, regardless of the version you are on, FIX works the same way - this won't work in 5 or 6x.Regards,Jade---------------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

  • Need help in converting BSO calc in to MDX in ASO

    Hi,
    Please find the calc that calcs Cash App Write Offs in calc script in BSO cube
    Fix(Feb,FY11,Actual,allocation,@levmbrs("All End Users",0),@levmbrs("All Sold To",0));
    "Cash App Write Offs"
    IF ("Invoice Price Gross Sales"->"All Products"->"BW_Input" ==#missing)
                        "Cash App Write Offs" = "Allocation_Input_Cash_Writeoff";
    ELSE
    "Cash App Write Offs"->"Allocation" = "Product_Pct_of_Invoiced_Sales"->"BW_Input" *"Allocation"->"Allocation_Input_Cash_Writeoff"->"No Product";
    ENDIF
    Endfix
    Please let me know whether the below logic is correct for ASO cube through MDX for the above calc in BSO
    Case When IS([Scenario].currentmember,[Actual]) and IS([Dimension].currentmember,[Allocation]) and IS
    ([Years].currentmember,[FY11]) and IS ([Time].currentmember,[Feb]) and IsLevel([All End Users].CurrentMember, 0)
    and IsLevel([All Sold To].CurrentMember, 0) and ([Invoice Price Gross Sales],[All Products],[BW_Input])=#Missing))
    Then
    [Cash App Write Offs]=[Allocation_Input_Cash_Writeoff]
    Else
    ([Cash App Write Offs],[Allocation])=([Product_Pct_of_Invoiced_Sales],[BW_Input])*([Allocation],
    [Allocation_Input_Cash_Writeoff],[No Product])
    End
    Thanks in advance....
    Edited by: 848657 on Mar 30, 2011 9:40 AM

    hi,
    chk this code.
    CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
    amount = amount
    currency = 'EUR'
    filler = ' '
    language = 'E'  => give the language as italian
    IMPORTING
    in_words = amountrs.
    rgds
    anver
    pls mark all hlpful answers

  • Essbase 9.3 Calc scripts. Pb with dates. How to convert (string = number) ?

    Hello,
    I've a problem with Essbase(Planning?) Scripts on version 9.3. It looks simple but I do not find any (clean) solution :
    On my Essbase database, I have a member called "Reference_Date" on my axis Indicators. It is a date data type, that is to say, it displays a number corresponding to a YYYYMMDD format. For example : 20091029 for October 29th 2009.
    In calc scripts I often need to compare the month included in that "Reference_Date" with the current Member of my Time Axis (I have 12 Months members based on the format M02 for February for example). The final aim is to calculate a number of complete years since that "Reference_Date".
    But theses two elements are not of the same "type" (one is a number value and the other is a "member" in Time Axis). So I'm forced to convert one of this two elements in order to compare it.
    For example I can extract the month value of the "Reference_Date"' and put an "M" before it to have a Time member equivalent or I can convert the member Name M10 to a number (10))
    in both cases I have the same type problem : I don't know how to convert a string into a number nor how to convert a number into a string.
    (For example @CONCATENATE doesn't work with numbers). and that my only remaining problem.
    I didn't find any Essbase Function which do this (conversion number <=>string).
    Is anyone have an Idea ?
    Thanks for your help
    Best regards

    I don't know any way for you to compare your data against your metadata. Not directly. To me it makes little enough sense to try that I'm not surprised the developers didn't provide for it.
    I've converted member names to strings, manipulated the strings (calc script functions are not good at this), and turned them back into member names, but that's really the only use I've had for string manipulation. I don't think an equivalency operator even exists for string data. And I see no way to begin thinking of a member name, once converted to a string, as a number.
    It makes even less sense to me to try thinking of a data value as a string. Even text values in Sys 11 are stored as numbers. Not encoded characters, but just a number to look up somewhere.
    I think you can do what you want though, with something like this...
    IF (@ISMBR("FY08"))
    vYr = 2008;
    ELSEIF (@ISMBR("FY09"))
    vYr = 2009;
    ENDIF;
    IF (@ISMBR("M01"))
    vMth = 1;
    ELSEIF (@ISMBR("M02"))
    vMth = = 2;
    ENDIF;
    "Years_Since_Reference" = ((vYr * 100) + Mth) - ("Reference_Date" / 12);
    Obviously, the math will need some work, coz that doesn't actually work, but the logic above essentially turns your metadata into numbers, which is what you are after.
    Good luck,
    -- Joe

  • Converting Member Formulas to MDX

    Hi Experts!
    I'm converting member formulas to MDX for an ASO cube I created and I'm having trouble with the ones that use @MDSHIFT. I'm new to MDX and trying to learn as I go. One of the formulas I'm struggling with is:
    IF( @ISMBR("Budget"))
    (("Operating Results"-
    (@MDSHIFT("Operating Results", -1, "Years", , 10,"Budget",)+
    "Reclassification Operating Results"))/
    (@MDSHIFT("Operating Results", -1, "Years", , 10,"Budget",)+
    "Reclassification Operating Results"))*100;
    ELSEIF( @ISMBR("Business Plan"))
    (("Operating Results"-
    (@MDSHIFT("Operating Results", -1, "Years", , -4,"Business Plan",)+
    "Reclassification Operating Results"))/
    (@MDSHIFT("Operating Results", -1, "Years", , -4,"Business Plan",)+
    "Reclassification Operating Results"))*100;
    ELSE
    (("Operating Results"-
    (@MDSHIFT("Operating Results", -1, "Years",)+
    "Reclassification Operating Results"))/
    (@MDSHIFT("Operating Results", -1, "Years",)+
    "Reclassification Operating Results"))*100;
    ENDIF;
    This is for a change year over year % member. Any help would be much appreciated! Thanks!
    -Cheers

    In all honesty - it looks like you should not just 'convert it.' I dont see any real need to use MDSHIFT here. I would just use PrevMember function for years, while hardcoding the scenario into the tuple.

  • Converting MDX queries to OBIEE 11g

    How can I convert MDX queries to OBIEE queries. Im migrating Hyperion/Brio reports to OBIEE 11g reports.

    You can always plug in your cubes as datasources into OBIEE and then create the analyses using Answers.
    A direct MDX-to-"OBIEE" path only exist if you copy your MDX queries and paste them into a direct database request which uses a conncetion pool pointing towards your cube. That said...you will miss out on a lot of vanilla functionality if you do this.
    Cheers,
    C.

  • Convert a query to MDX

    Hi,
    I created a query in Business query desginer and i want to convert into MDX. Please update me for this.
    Thanks
    Ankur Kuchhal

    Hi,
    You can create a MDX query in MDXTEST t.code and you can also test the same.
    Cheers,
    Malli.

  • Corresponding MDX for calc script function

    <p>hi all,</p><p> </p><p>I have converted my BSO outline to ASO in 7.1.2.There in BSO oneof the members had formula which used functions like @XRANGE and@MOVSUM</p><p>now i need to write the MDX script for the corresponding memberBut i am not able find any function supporting this in MDX.</p><p> </p><p>Can somebody can help me out in this?</p><p> </p><p>thanks...</p>

    @MOVSUM() is probably best replaced by the following MDX for a trailing sum:<BR><BR>Sum (<BR> LastPeriods (<BR> (number of time periods here),<BR> [Time].CurrentMember<BR> ),<BR> (account you want to sum, or omit to do across all accounts)<BR>)<BR><BR>For a centered sum, you'd say something like:<BR><BR>Sum (<BR> LastPeriods (<BR> (number of time periods in range here),<BR> [Time].CurrentMember.Lead ( (number of steps ahead to start range) )<BR> ),<BR> (account you want to sum, or omit to do across all accounts)<BR>)<BR><BR>@XRANGE will have a corresponding TupleRange() function in Essbase 9. But in an ASO database,<BR>splitting the time dimension into separate year and period parts isn't generally worth it. Instead, having Month and Quarter levels of an attribute dimension gives users the ability to split them out, while making full use of the time series functions. <BR><BR>What specifically are you using @XRANGE to accomplish? Maybe you don't even need the newer TupleRange() function.<BR>

Maybe you are looking for