简体   繁体   中英

Calculated Measure based on multiple dimensions. Ignore some dimensions

I need to compare each item in my 5-dimensional selection to a cell that sits at intersection of just two dimensions

I have the following MDX:

WITH MEMBER [measures].[x] AS
        (
            [dim1].[dim1].[certainDim1_Member]
            ,[dim2].[dim2].[certainDim2_Member]
            ,[measures].[a]
        )
SELECT 
    NON EMPTY {[measures].[a], [measures].[x]} ON 0,
    NON EMPTY   {
                     [dim1].[dim1].children
                    *[dim2].[dim2].children
                    *[dim3].[dim3].children
                    *[dim4].[dim4].children
                    *[dim5].[dim5].children
                } ON 1
FROM [cubename]

The problem is the query takes into account currentmember of dim3, dim4, dim5. and the result is distorted.

When I try this:

WITH MEMBER [measures].[x] AS
        (
             [dim1].[dim1].[certainDim1_Member]
            ,[dim2].[dim2].[certainDim2_Member]
            ,[dim3].[dim3].[all]
            ,[dim4].[dim4].[all]
            ,[dim5].[dim5].[all]
            ,[measures].[a]
        )

the query dies in 2+ minutes because of memory lack

while this

WITH MEMBER [measures].[x] AS
        (
             [dim1].[dim1].[certainDim1_Member]
            ,[dim2].[dim2].[certainDim2_Member]
            ,[dim3].[dim3].[all]
            ,[dim4].[dim4].[all]
            --,[dim5].[dim5].[all]
            ,[measures].[a]
        )

returns a result in 3 seconds.

I have to use all 5 dimensions and even more.

If you change it to the aggregation of a set of tuples across that measure does it still function?

WITH MEMBER [measures].[x] AS
    Aggregate(
        {(
          [dim1].[dim1].[certainDim1_Member]
         ,[dim2].[dim2].[certainDim2_Member]
         ,[dim3].[dim3].[all]
         ,[dim4].[dim4].[all]
         ,[dim5].[dim5].[all]
         )},
        [measures].[a]
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM