MDX Query to Calculated member

Hi All,
I have a MDX query which works fine, when converting the query to Calculated member, I get the same result for all the rows of a dimension.
select {[Measures].[Contents]} on 0,
([Dim Products].[Product Alias].[Product Alias].members,
(filter ([Dim Products].[Product ID].members,
instr(left([Dim Productss].[Product ID].currentmember.member_Key,3),'112')>0))) on 1
from
<<CubeName>>
Calculated Member:
SUM(filter ([Dim Products].[Product ID].members,
instr(left([Dim Products].[Product ID].currentmember.member_Key,3),'112')>0),[Measures].[Contents])
When I drag the dimension product, the calculated member showing the same result for all the products. Can anyone let me know the syntax error here.

Hi SQL GUN,
For me it works :
WITH MEMBER [Last3MonthsInternetSales] AS 
AGGREGATE
LastPeriods(-3, ClosingPeriod([Date].[Calendar].[Month], [Date].[Calendar].[Month].&[2005]&[12])), 
[Measures].[Internet Sales Amount]
SET MySet AS
{[Date].[Calendar].[Month].&[2005]&[09],
[Date].[Calendar].[Month].&[2005]&[10],
[Date].[Calendar].[Month].&[2005]&[11],
[Date].[Calendar].[Month].&[2005]&[12],
[Date].[Calendar].[Month].&[2006]&[01],
[Date].[Calendar].[Month].&[2006]&[02]}
SELECT
[Measures].[Internet Sales Amount],
[Last3MonthsInternetSales]
} ON COLUMNS,
MySet
} ON ROWS
FROM [Adventure Works]
Are u sure your query is correct. I think you might have a [Fiscal Month Num of Year] too much in your (). I'm not sure, but are u dragging the correct level of hierarchy ? Also in the part ON ROWS you seem to take a lot of levels with you.
Why for example take .allmembers when you only want the actual last 3 of your currentmember?
Can u check again?

Similar Messages

  • 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

  • MDX Query Not Working Well

    Hi guys,
    I created a calculated member using the following MDX query;
    CALCULATE; 
    CREATE MEMBER CURRENTCUBE.[Measures].[Dispute Accepted]
     AS 
            SUM(EXISTING([Measures].[Dispute Logged],([Dispute Status].[Status].&[Accepted]),([Date of Transaction].[Date].[All]))), 
    FORMAT_STRING = "Standard", 
    VISIBLE = 1 ,  DISPLAY_FOLDER = 'Dispute Management'  ;  
    And this is the output i got when I tried to browse the cube. Please can someone help me and check what is wrong with the query. Thanks
    me

    Hi lilutchay,
    Since this issue is related to Analysis Services, I will move this thread to Analysis Services forum. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  
    Thank you for your understanding and support.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Writing MDX query in outline??????

    Hi All,
    I have to write one MDX query for account member.
    Hierarchy:
    Accounts
    ---acm1
    ---acm2
    ---acm3
    Time
    ---2011
    ------Jan, 2011
    ------Feb, 2011
    ---2010
    ------Jan, 2010
    ------Feb, 2010
    Division
    ---East
    ------A
    ---------a
    ------B
    ---------b
    ---West
    ---North
    ---South
    Now i need to calculate AVG for acm1 which is in accounts dimension based on Year and Division.
    I have written
    Sum(([Accounts].[TotalCreationToInvoiceDayNumber],[TimeMonth].CurrentMember.LastChild):([Accounts].[TotalCreationToInvoiceDayNumber],[TimeMonth].CurrentMember.LastChild.LastChild.Lag(11)))
    Count(CrossJoin({[Accounts].[TotalCreationToInvoiceDayNumber]},{({[TimeMonth].CurrentMember.LastChild.LastChild:[TimeMonth].CurrentMember.LastChild.LastChild.Lag(11)})}
    But it is not working, Can you please help me to complete this query????
    Thanks,
    Prathap

    This will give you some idea
    Re: Writing formula in Outline??????
    Regards,
    RSG

  • MDX Query using BottomCount to limit Median calculation returns null

    I'm building a new cube that includes some person age values that aren't useful when summed, but are
    useful when the median is determined. The measure group that contains the measure for the age has a 1-1 relationship with a dimension in the cube because both use the same table as the source. This is important because I use the key attribute of the dimension
    as the set expression in the Median function to prevent any summation before the median is found. Here is the code for the original median calculation:
    MEMBER Measures.[Median Age] AS
    MEDIAN(
    [Placement Dimension].[Id Removal Episode Fact].Members,
    [Measures].[Age At Removal Months]
    This median naturally represents the half-way point in the series of values. My analysts have also requested
    median-type values at the quarter and three-quarter points in the same series. I've been able to accomplish this for the three-quarter point by nesting the TopCount function in the set expression of the Median function to limit the set to the last half of
    the records and then find the median point like this:
    MEMBER Measures.[75th Percentile] AS
    MEDIAN(
    TOPCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    However, my attempt to use the BottomCount function in the same way as TopCount to find the quarter point
    in the whole data set by limiting the calculation's set to the first half of the data always returns null. Here is how I've formed the code:
    MEMBER Measures.[25th Percentile] AS
    MEDIAN(
    BOTTOMCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    And here is the query that returns the values:
    SELECT
    Measures.[Episode Count]
    ,Measures.[Median Age]
    ,Measures.[25th Percentile]
    ,Measures.[75th Percentile]
    } ON 0
    ,[Date Begin].[Calendar Hierarchy].Year.&[2011]:[Date Begin].[Calendar Hierarchy].Year.&[2014] ON 1
    FROM [POC Cube]
    WHERE
    [Age at Removal Mos].[Age in Years List].[Age Year].&[0]:[Age at Removal Mos].[Age in Years List].[Age Year].&[5]
    I don't know why the end result is always null. I don't have any null values in the data for this measure, and I know what values I should be seeing because I've found the median records manually in results from a SQL Server query. I've tried using TopCount
    and multiplying Measures.[Age At Removal Months] in the TopCount function by -1 to workaround the descending sort, but I still get nulls. I've also tried separating these queries out so the quarter point and three-quarter point calculations aren't run together,
    but I still get nulls for the quarter point calculation.
    I'm open to any help fixing this situation by modifying my current code or by using alternate methods, but the end result has to be dynamic enough to be used as a calculation in the cube. Thanks!

    The links might helps.
    http://technet.microsoft.com/en-us/library/ms144864.aspx
    http://www.mssqltips.com/sqlservertip/3034/sql-server-analysis-services-ssas-2012-top-and-bottom-functions/
    http://www.sqlservercentral.com/blogs/bradleyschacht/2012/03/12/mdx-functions-bottomcount/

  • Several calculated members in MDX query error

    Hi all,
    When I try to run this query on TX MDXTEST:
    WITH
    MEMBER [Measures].[284B70E6-5D9B-48A9-A8,39,F6,8C,24,8F,3D,84]
         AS ' [Measures].[4GPT8EYWQP8HAE0GFNSERQ9ZC]-[Measures].[4GPT8D1S01T3MR5EZ57C98LJC] '
    MEMBER [Measures].[97630961-6154-4C5F-8C,72,C,DF,23,48,B1,19] AS
    ' [Measures].[4GPT8D1S01T3MR5EZ57C98LJC]-[Measures].[4GPT8EYWQP8HAE0GFNSERQ9ZC] '  
    SELECT 
    { [Measures].[284B70E6-5D9B-48A9-A8,39,F6,8C,24,8F,3D,84],
      [Measures].[97630961-6154-4C5F-8C,72,C,DF,23,48,B1,19] }  ON COLUMNS
    , NON EMPTY
         CROSSJOIN(
              CROSSJOIN(  { [0CALMONTH].[200912] } ,  { [0STOR_LOC__ZCHINEYP].[X] }  ), [0PLANT].[LEVEL01].MEMBERS )
            DIMENSION PROPERTIES [0CALMONTH].[20CALMONTH], [0STOR_LOC__ZCHINEYP].[20STOR_LOC__ZCHINEYP] ON ROWS
    FROM [ZIC_MP01/ZIC_Q01]
    I get the following error:
    System error in program CL_RSD_MULTIPROV and form GET_IOBJNM_PROVID-03
    I run the report CL_RSDRC_MULTIPROV of the note 1090490 explains (Error in class CL_RSD_MULTIPROV) and nothing happened.
    When I delete any of the calculated members of the query, the query works
    WITH
    MEMBER [Measures].[284B70E6-5D9B-48A9-A8,39,F6,8C,24,8F,3D,84]
         AS ' [Measures].[4GPT8EYWQP8HAE0GFNSERQ9ZC]-[Measures].[4GPT8D1S01T3MR5EZ57C98LJC] '
    SELECT 
    { [Measures].[284B70E6-5D9B-48A9-A8,39,F6,8C,24,8F,3D,84] }  ON COLUMNS
    , NON EMPTY
         CROSSJOIN(
              CROSSJOIN(  { [0CALMONTH].[200912] } ,  { [0STOR_LOC__ZCHINEYP].[X] }  ), [0PLANT].[LEVEL01].MEMBERS )
            DIMENSION PROPERTIES [0CALMONTH].[20CALMONTH], [0STOR_LOC__ZCHINEYP].[20STOR_LOC__ZCHINEYP] ON ROWS
    FROM [ZIC_MP01/ZIC_Q01]
    Any ideas?
    Regards

    Hi,
    just to make sure. this forum is about the SAP Integration Kit. are those MDX items coming from an OLAP Universe ?
    thanks
    Ingo

  • Custom Calculation in ASO - Error in MDX query

    Hi All,
    We are trying to use a run a custom calculation on our ASO cube
    We are getting the error as below
    Syntax error in input MDX query on line 13 at token ' )'
    When i checked my POV i did not find any issue. Even when I try to put only one crossjoin, it is still giving me the error saying "error at line 2')' "
    I am unable to find the cause of this issue.
    Can any one help me on this.
    ******content of Maxl Script********
    execute calculation on database ASOFNPLN.ASOFNPLN with local script_file D:\++++++++Sateesh+++++++\ADWEA\Custom.csc"
    POV
    "Crossjoin({[FY09]},
    Crossjoin({[Actual]},
    Crossjoin ({[Jan],[Feb]},
    Crossjoin({[Working]},
    CrossJoin({[XA]},
    CrossJoin({[0000000]},
    CrossJoin({[000000000]},
    CrossJoin({[00000]},
    CrossJoin({[175110]},
    CrossJoin({[CC_ADWEA_0000_AED]},
    CrossJoin({[Unspecified Product]},
    CrossJoin({[HSP_InputValue]},
    CrossJoin({[Local]} )))))))))))))"
    SourceRegion "{[Opening Balance],[Ending Balance],[Periodic Balance]}";
    *************** Content of Custom.csc *********
    case when
    IsUda([Account].currentMember, "Expense") OR IsUda([Account].currentMember, "Revenue")
    AND
    Is([Period].CurrentMember, [Jan]) OR Is([Period].CurrentMember, [Feb]) OR Is([Period].CurrentMember, [Mar]) OR Is([Period].CurrentMember, [Apr]) OR Is([Period].CurrentMember, [May]) OR Is([Period].CurrentMember, [Jun]) OR Is([Period].CurrentMember, [Jul]) OR
    Is([Period].CurrentMember, [Aug]) OR Is([Period].CurrentMember, [Sep]) OR Is([Period].CurrentMember, [Oct]) OR Is([Period].CurrentMember, [Nov]) OR Is([Period].CurrentMember, [Dec]) OR Is([Period].CurrentMember, [YearTotal])
    THEN
    ([Ending Balance]):=([Opening Balance]+[Periodic Balance]);
    ([Opening Balance]):=([View].[Ending Balance], [Period].CurrentMember.lag(1));
    ([Ending Balance]):=([Opening Balance]+[Periodic Balance]);
    END

    You've got a mismatched " in the first line of the "execute calculation" statement.
    However, I think the real problem is in the calc script.  I don't believe you can do this in MDX:
    CASE WHEN x THEN
        a := y;
        b := z;
    END
    You have to do this:
    a := CASE WHEN x THEN y END;
    b := CASE WHEN x THEN z END;
    An alternative is to create a formula member for each of the measures you are trying to set (with the member formula containing the CASE logic) and have the calc script copy the formula member to the permanent member.

  • Help in creating MDX Calculated Member using attributes from multiple Dimension

    Hi All,
    First of all my knowledge on MDX is basic. In one of our projects, there is a requirement to create calculated member (similar to derived fields in SQL) which is more of a dimension attribute and not really a calculated member. Due to IP issues I cannot paste
    the actual queries but I will provide an SQL Query equivalent to what I am trying to achieve:
    Select P.Product, Case When ISNULL(FS.ArtistName,'') = '' Then P.ArtistName Else FS.ArtistName End Artist
     From
    dbo.FactMusicSales FS
    Join dbo.dimProduct P
    on P.DimProductKey =  FS.DimProductKey
    We are trying to replicate the logic for derving the "Artist" field using MDX script.
    We are running into issues while trying to build an MDX expression using the above logic. The main issue being that the new field/member "Artist" would not be calculated unless its elements are selected (FS.ArtistName, P.ArtistName). Besides this
    we are also unable to place this new member in a different folder other than a sub folder under the measures. Any pointers to solving this would be really helpful.
    Thanks in Advance,
    Venki

    Hi Venki,
    According to your description, you need to create calculated member (similar to derived fields in SQL) which is more of a dimension attribute and not really a calculated member, right?
    In your scenario, you needn't to achieve this requirement by using MDX. You can use a named query on your data source view. A named query is a SQL expression represented as a table. In a named query, you can specify an SQL expression to select rows and columns
    returned from one or more tables in one or more data sources. So in you scenario, you can use your query on the DSV, and then use the modified table to create a dimension.
    http://msdn.microsoft.com/en-IN/library/ms175683.aspx
    Regards,
    Charlie Liao
    TechNet Community Support

  • MDX Calculated Member With Multiple Conditions

    I need to create a calculated member in my cube that spans multiple dimensions. A current calculated member looks like this:
    [Employee Hours Category].[Utilization Category].[NON-PTO], [Measures].[Employee Hours]
    This calculated member returns all the hours an employee worked that are not PTO.
    I need to select employee hours but with multiple conditions:
    - [DIM BILL STATUS][Bill Status] equals 0
    - [Employee Hours Time Category].[Time Category] equals "Client Facing"
    - [DIM PROJECT].[Client] isn't like "Olson"
    I know this is probably pretty easy, but I'm horrible with MDX!
    Thank you!!
    A. M. Robinson

    Thank you...
    Your answer looks good but I was actually able to figure out most of it, but still looking how to incorporate a FILTER into the MDX. I would like to FILTER like this:
     FILTER ([DIM Project].[Client].[Client].Members , 
                 NOT InStr([DIM Project].[Client].CurrentMember.MEMBER_NAME, "Olson")
    Heres the MDX I have so far that is working fine:
    ([Employee Hours Time Category].[Time Category].&[Client Facing],
       [DIM BILL STATUS].[Bill Status ID].&[1], [Measures].[Employee Hours])
    Do you just wrap the whole MDX in the filter, and if so, how would that be formatted?
    A. M. Robinson

  • SSRS report with tabular model – MDX query CoalesceEmpty function does not return the provided string value

    Hello everyone,
    I created following calculated member in MDX query. I am using it in one of the report parameter in dataset (single select dropdown list as report parameter).
    WITH MEMBER [Measures].[ParameterCaption] AS
    CoalesceEmpty([Customer].[National Account Code].CURRENTMEMBER.MEMBER_CAPTION,'None')
    I would like to display 'None' text at the top of the dropdown list values. So that when user selects 'None' then this parameter will not considered in MDX query else the selected National Account Code will be considered to filter report data. But,
    the above return blank/empty value for  [Customer].[National Account Code].&  member though I specified 'None' as text in CoalesceEmpty function. Any advice would be appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Hi Ankit,
    It seems that you issue had been solved in your another thread.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5a5becac-226f-428a-95b0-aaaa22733818/ssrs-report-with-tabular-model-create-a-dropdown-report-parameter-with-none-option-as-the-top?forum=sqlanalysisservices#0e51bf8c-a66c-4df5-a244-0147728fdfdb
    iif([Customer].[National Account Code].CURRENTMEMBER.MEMBER_CAPTION="","None",[Customer].[National
    Account Code].CURRENTMEMBER.MEMBER_CAPTION)
    I marked this reply as answer, it will benefit to other members who have the similar issue.
    Regards,
    Charlie Liao
    TechNet Community Support

  • When using TODATE function MDX query is not correctly generated

    Essbase 9.3.1.2 and OBIEE 10.1.3.4.1.
    When using TODATE function MDX query is not correctly generated.
    This leads to unexpected values not only on cumulative columns in report (generated with TODATE), but also other columns (calculated with AGO function or directly read from cube) have incorrect values.
    The problem occurs when you filter on a column that is not in the select list. If you filter on just one level of dimension, results are fine. You can filter on multiple dimensions as long as you filter on just one level of each dimension.
    If you filter on two or more levels of one dimension, than results are not correct. In some cases results for TODATE column are all zeros, in some cases it is a random value returned by Essbase (same random value for all rows of that column), and in some cases BI Server returns an error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. Essbase Error: Network error [10054]: Cannot Send Data (HY000).
    Here is generated MDX code:
    With
    set [Grupe proizvoda2] as '{[Grupe proizvoda].[N4]}'
    set [Grupe proizvoda4] as 'Generate([Grupe proizvoda2], Descendants([Grupe proizvoda].currentmember, [Grupe proizvoda].Generations(4), leaves))'
    set [Segmentacija2] as '{[Segmentacija].[RETAIL]}'
    set [Segmentacija4] as 'Filter(Generate({[Segmentacija2]}, Descendants([Segmentacija].currentmember, [Segmentacija].Generations(4),SELF), ALL), ([Segmentacija].CurrentMember IS [Segmentacija].[AFFLUENT]))'
    set [Vrijeme3] as '{[Vrijeme].[MJESEC_4_2009]}'
    member [Segmentacija].[SegmentacijaCustomGroup]as 'Sum([Segmentacija4])', SOLVE_ORDER = AGGREGATION_SOLVEORDER
    member [Accounts].[MS1] as '(ParallelPeriod([Vrijeme].[Gen3,Vrijeme],2,[Vrijeme].currentmember), [Accounts].[Trosak kapitala])'
    member [Accounts].[MS2] as '(ParallelPeriod([Vrijeme].[Gen3,Vrijeme],1,[Vrijeme].currentmember), [Accounts].[Trosak kapitala])'
    member [Accounts].[MS3] as 'AGGREGATE({PeriodsToDate([Vrijeme].[Gen2,Vrijeme],[Vrijeme].currentmember)}, [Accounts].[Trosak kapitala])'
    select
    { [Accounts].[Trosak kapitala],
    [Accounts].[MS1],
    [Accounts].[MS2],
    [Accounts].[MS3]
    } on columns,
    NON EMPTY {crossjoin ({[Grupe proizvoda4]},{[Vrijeme3]})} properties ANCESTOR_NAMES, GEN_NUMBER on rows
    from [NISE.NISE]
    where ([Segmentacija].[SegmentacijaCustomGroup])
    If you remove part with TODATE function, the results are fine. If you leave TODATE function, OBIEE returns an error mentioned above. If you manually modify variable SOLVE_ORDER and set value to, for example, 100 instead of AGGREGATION_SOLVEORDER, results are OK.
    In all cases when this variable was modified in generated MDX, and query manually executed on Essabse, results were OK. This variable seems to be the possible problem.

    Hi,
    Version is
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    Sorry, in my last post i forgot to mention that i already created a function based index but still it is not using because, there is a UNIQUE constraint on that column.
    Thanks

  • SSRS report with tabular model – MDX query how to get the sum and count of measure and dimension respectively.

    Hello everyone,
    I am using the following MDX query on one of my SSRS report.
    SELECT NON EMPTY { [Measures].[Days Outstanding], [Measures].[Amt] } ON COLUMNS,
    NON EMPTY { ([Customer].[Customer].[Customer Key].ALLMEMBERS) }
    HAVING [Measures].[ Days Outstanding] > 60
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
    FROM ( SELECT ( STRTOSET(@Location, CONSTRAINED)) ON COLUMNS
    FROM ( SELECT ( {[Date].[Fiscal Period].&[2014-06]}) ON COLUMNS
    FROM [Model]))
    Over here, the data is being filtered always for current month and for a location that is being selected by user from a report selection parameter.
    I would like to get the count of total no. of customers and sum of the amount measure.
    When I am using them in calculated members it gives incorrect values. It considers all records (ignores the sub-select statements) instead of only the records of current month and selected location.
    I also tried with EXISTING keyword in calculated members but there is not difference in output. Finally, I manage the same at SSRS level.
    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Any help would be much appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
    Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
    Hi Ankit,
    We can use SUM function and COUNT function to sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension. Here is a sample query for you reference.
    WITH MEMBER [measures].[SumValue] AS
    SUM([Customer].[Customer].ALLMEMBERS,[Measures].[Internet Sales Amount])
    MEMBER [measures].[CountValue] AS
    COUNT([Customer].[Customer].ALLMEMBERS)
    MEMBER [Measures].[DimensionName] AS [Customer].NAME
    SELECT {[Measures].[DimensionName],[measures].[SumValue],[measures].[CountValue]} ON 0
    FROM [Adventure Works]
    Besides, you ask that does it make any difference if I manage it as SSRS level and not at MDX query level. I don't thinks it will make much difference. The total time to generate a reporting server report (RDL) can be divided into 3 elements:Time to retrieve
    the data (TimeDataRetrieval);Time to process the report (TimeProcessing);Time to render the report (TimeRendering). If you manage it on MDX query level, then the TimeDataRetrieval might a little longer. If you manage it on report level, then the TimeProcessing
    or TimeRendering time might a little longer. You can test it on you report with following query: 
    SELECT Itempath, TimeStart,TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
    TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount],Source
    FROM ExecutionLog3
    WHERE itempath like '%reportname'
    Regards,
    Charlie Liao
    TechNet Community Support

  • SSAS Tabular : MDX query goes OutOfMemory for a larger dataset

    Hello all,
    I am using SSAS 2012 Tabular to build the cube to support the organizational reporting requirements. Right now the server is Windows 2008 x64 with 16GB of Ram installed. I have the following MDX query. What this query does is get the member caption of the
    “OrderGroupNumber” non-key attribute as a measure where order group numbers pertain to a specific day and which occurs in specific seconds of a day. As I want to find in which second I have order group numbers, I cross the time dimension’s members with a specific
    day and filter the tuples using the transaction count. The transaction count is a non-zero value if an Order Group Number occurs within a specific second of a selected day.
    At present “TransactionsInflight].[OrderGroupNumber].[OrderGroupNumber]” has 170+ million members (Potentially this could grow rapidly) and time dimension has 86400 members.
    WITH
    MEMBER [Measures].[OrderGroupNumber]
    AS IIF([Measures].[Transaction Count] > 0, [TransactionsInflight].[OrderGroupNumber].CURRENTMEMBER.MEMBER_CAPTION,
    NULL)
    SELECT
    NON EMPTY{[TransactionsInflight].[OrderGroupNumber].[OrderGroupNumber].MEMBERS}
    ON COLUMNS,
    {FILTER(([Date].[Calendar Hierarchy].[Date].&[2012-07-05T00:00:00], [Time].[Time].[Time].MEMBERS),
    [Measures].[Transaction Count] > 0) } ON
    ROWS
    FROM [OrgDataCube]
    WHERE [Measures].[OrderGroupNumber]
    After I run this query it reaches to a dead-end and freezes the server (Sometimes SSAS server throws OutOfMemory exception but sometimes it does not). Even though I have 16GB of memory it uses all the memory and doing nothing. I have to do a hard-reset against
    the server to get the server online. Even I limit the time members using the “:” range operator still the machine freeze. I have run out of solutions to fine-tune the design. Could you guys provide me some guidelines to optimize this query? I am willing to
    do a design change if it is necessary.
    Thanks and best regards,
    Chandima

    Hi Greg,
    Finally I found the problem why the query goes out of memory in tabular mode. I guess this information will helpful for others and I am posting my findings.
    Some of the non-key attribute columns in the tabular model tables (mainly the tables which form dimensions) do not contain pretty names. So for the non-key attribute columns which I need to provide pretty names I renamed the columns to something else.
    For an example, in my date dimension there is a non-key attribute named “DateAltKey”. This is the date column which I am using. As this is not pretty to the client tools I renamed this column as “Date” inside the designer (Dimension
    design screen). I deployed the cube, processed the cube and no problem.
    Now here comes the fun part. For every table, inside the Tables node (Tabular SSAS Database > Tables) you can view the partition details. You have single partition per dimension table if you do not create extra partitions. I opened the partitions screen
    and clicked on the “Edit” icon and performed a Syntax Check. Surprisingly it failed. It complains about the renamed column. It complained “Date” cannot be found in source. So I realized that I cannot simply rename the columns like that.
    After that I created calculated columns (with a pretty name) for all the columns which complained and all the source columns to the calculated columns were hid from the client tools. I deployed the cube, processed the cube and performed a
    syntax check. No errors and everything were perfect.
    I ran the query which gave me trouble and guess what... it executed within 5 seconds. My problem is solved. I really do not know who did this improve the performance but the trick worked for me.
    Thanks a lot for your support.
    Chandima

  • Setting default member of attribute hierarchy in MDX script. Default member not taken into account while using user defined hierarchy

    Hi all
    I have a date dimension that (type time) with attributes
    - [FiscalYear] (type years)
    - [FiscalMonth] (type months)
    - [FiscalWeek] (type weeks)
    In addition to the attributes used in the natural hierarchy, I have an attribute [PerType] containing one member comming from the relational table 'WTD' which corresponds to 'Current Date'. All other members of this attribute hierarchy are calculated members (defined in the MDX script). Examples:
    --Last year
    CREATE MEMBER CURRENTCUBE.[Date].[PerType].[LY] AS NULL,
    VISIBLE = 1;
    SCOPE([Date].[PerType].[LY]);
    SCOPE(DESCENDANTS([Date].[Fiscal].[All], [Date].[Fiscal].[Year], SELF_AND_AFTER));
    THIS = ([Measures].CurrentMember, [Date].[PerType].[WTD], ParallelPeriod([Date].[Fiscal].[Year], 1));
    END SCOPE;
    END SCOPE;
    --Month to date
    CREATE MEMBER CURRENTCUBE.[Date].[PerType].[MTD] AS NULL,
    VISIBLE = 1;
    SCOPE([Date].[PerType].[MTD]);
    SCOPE(DESCENDANTS([Date].[Fiscal].[All], [Date].[Fiscal].[Week], SELF_AND_AFTER));
    THIS = Aggregate(CrossJoin({[Date].[PerType].[WTD]}, MTD([Date].[Fiscal].CurrentMember)));
    END SCOPE;
    END SCOPE;
    --Year to date
    CREATE MEMBER CURRENTCUBE.[Date].[PerType].[YTD] AS NULL,
    VISIBLE = 1;
    SCOPE([Date].[PerType].[YTD]);
    SCOPE(DESCENDANTS([Date].[Fiscal].[All], [Date].[Fiscal].[Period], SELF_AND_AFTER));
    THIS = Aggregate(CrossJoin({[Date].[PerType].[WTD]}, YTD([Date].[Fiscal].CurrentMember)));
    END SCOPE;
    END SCOPE;
    The defalut member of FiscalWeek attribute hierarchy is set dynamically in the MDX script:
    ALTER CUBE CURRENTCUBE UPDATE DIMENSION [Date].[FiscalWeek], DEFAULT_MEMBER =
    Filter(
    [Date].[FiscalWeek].Members,
    [Date].[FiscalWeek].Properties( "FiscalWeekStartDate", TYPED) <= DateAdd("d", -2, CDate(CStr(Month(Now())) + "/" + CStr(Day(Now())) + "/" + CStr(Year(Now()))))
    AND
    [Date].[FiscalWeek].Properties( "FiscalWeekEndDate", TYPED) >= DateAdd("d", -2, CDate(CStr(Month(Now())) + "/" + CStr(Day(Now())) + "/" + CStr(Year(Now()))))
    )(0).PrevMember;
    If I run the following query:
    with member
    measures.x as [Date].[Fiscal].DefaultMember.Name
    measures.y as [Date].[FiscalWeek].DefaultMember.Name
    select
    measures.x,
    measures.y
    } on axis(0)
    from [GLWeekly]
    it gives me back correctly the default member set over the MDX script.
    I order the statements in the MDX Script so that the default period (week) is set at the beginning of the script (just after the calculate).
    I do not understand why creating the following calculated member I am obliged to specify [Date].[Fiscal].CurrentMember in the tuple to have correct results:
    MEMBER [Account].[CoA].[Standard Engagement Revenue (MTD)] AS ([Account].[CoA].[Standard Engagement Revenue], [Date].[PerType].[MTD], [Date].[Fiscal].CurrentMember)
    I would expect that:
    ([Account].[CoA].[Standard Engagement Revenue], [Date].[PerType].[MTD])
    is sufficient.
    If the default week is specified in the slicer using a member of the natural hierachy (=> [Date].[Fiscal].x) it works.
    Why can't SSAS use the default member if it is must defined in the MDX script?
    Can someone explains me this. Thanks a lot in advance.

    Hi Ina,
    have you thought about adding a dynamic statement inside the MDX script? You could define the default member like this:
    ... DEFAULT_MEMBER = iif( Day( Now() ) = 3, <expression for previous month>, <expression for current month> );
    This way you don't need to change it everytime by running a script.
    By the way, what do you mean it doesn't update the default member? When you execute this MDX what does it says?
    with member measures.x as [Dimension].[HierarchyName].DefaultMember.Name
    select { measures.x } on 0 from Cubename
    If this returns the correct name, then the problem is somewhere else. I believe it should return you the correct name. Look here, test this on Adventure Works, statement by statement and see what happens.
    ALTER
    CUBE [Adventure Works]
    UPDATE
    DIMENSION [Product].[Product Categories],
    DEFAULT_MEMBER = [Product].[Product Categories].[Category].&[1]
    with
    member measures.x
    as [Product].[Product Categories].DefaultMember.Name
    select measures.x on 0
    from [Adventure Works]
    ALTER
    CUBE [Adventure Works]
    UPDATE
    DIMENSION [Product].[Product Categories],
    DEFAULT_MEMBER = [Product].[Product Categories].[All Products]
    with
    member measures.x
    as [Product].[Product Categories].DefaultMember.Name
    select measures.x on 0
    from [Adventure Works]
    I think you can see which members are default (on related hierarchies) using
    MDX Studio. This should help you detect which attributes have not moved accordingly and hence cause problems in your report. The usual suspects are those attributes used in your last month reports. If that's too much for you, just copy paste the definition
    of the measure x and use .CurrentMember instead .DefaultMember. And so for all related hierarchies of your dimension. You can run it as one query, just put enough measures (x1, x2, ...), one for each hierarchy, ok?
    Here's a test for Day():
    with
    member measures.y
    as
    iif( Day(Now()) = 28, 'Yes', 'No' )
    select
    measures.y on 0
    from [Adventure Works]
    Today this returns Yes, tomorrow it will be No.
    Ups, I just checked one more thing. When you run the script, it sets the default member only for that session. If you execute the first two of the four statements that I've sent you, it will set the default member on Bikes and show you that.
    But, if you open another query windows and execute that select statement (only), you'll see All member instead. So, it has set it to Bikes only for the currect session. Consequence? You reports are not aware of it. So, better use dynamic statement in
    your MDX script.
    Regards,
    Tomislav Piasevoli
    Business Intelligence Specialist
    www.softpro.hr

  • Declare variables in an MDX query

    Is it possible to declare variables in an MDX query like transact sql? something like this:
    DECLARE @date1 date
    DECLARE @month1 int
    set @date1 = '12-12-2012'
    set @month1=DATEPART(m, @date1)-1
    select @date1 as dt1, @mesreferencia as mt1

    Hi ,
      In MDX , you will not be able to put variables in MDX. But Query scoped calculated measures can be used for such cases. The equivalent MDX for the above is
    WITH MEMBER [MEASURES].Dt
    As
    CDATE('12-12-2012')
    MEMBER MEASURES.DTPart
    As
    DATEPART("M", MEASURES.Dt)-1
    SELECT {MEASURES.Dt,MEASURES.DTPart} ON 0
    FROM [Adventure Works]
    Best Regards Sorna

Maybe you are looking for

  • New Airport Extreme network won't hold stream to Apple TV

    (I thought about posting this in the Apple TV forum but I think this is more appropriate here.) For months I had a network configured in my home that included two Airport Express base stations. My cable modem plugged directly into one of them (in my

  • How can I create a new EJB project ?

    Hi, I downloaded the trial version and I don't know how to create an EJB project ? When I create a new project, I've only the web template to choose. Where can I find informations about that ? Thanks. jack

  • Is there a way to save an image file as a jpeg and add -web or -print to the file name?

    I am trying to find a way to save my image file as a jpeg and add -web or -print to the existing file name.  This way I can easily see which files are lower resolution for web posting or high resolution for printing.

  • Camera Raw plugin for Adobe CS

    I am running Adobe CS (rather than the most recent version of Photoshop) on my PC. I need to process RAW images from my Canon 30D. Can I use Camera Raw 3.4 with my Adobe CS, even though it came out to support CS2?

  • Mobileme widget not working

    I have a page set up in iWeb 09 and have a album page with all our mobileme gallery zI went to add a new mobileme widget and it does not see anything at all. I clicked to move 2 other ones and they are dead now as the others keep working. What is goi