我们正面临其中一个MDX查询的问题。 如果我们在where子句的Range中使用日期选择器,如果我们使用逗号作为分隔符,则执行else会花费6秒,大约需要1秒。
是否有办法通过在where子句中给出范围来修改查询并提高性能。请告诉我们您的意见。
示例1使用逗号分隔符
WITH MEMBER Measures.X AS SUM({[User].[column].CURRENTMEMBER},[Measures].[# User Count])
SELECT NON EMPTY
UNION({[User].[column].[ALL]},
Generate(Hierarchize([User].[Column].[ALL])
AS [XL_Filter_Set_0], TopCount(Except(DrilldownLevel([XL_Filter_Set_0].Current
AS [XL_Filter_HelperSet_0],,0,INCLUDE_CALC_MEMBERS), [XL_Filter_HelperSet_0])
, 5, [Measures].[# User Count]))
)DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS , Measures.X ON COLUMNS
FROM [Activity] where
({[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2012],[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2013],
[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2014]},
{[Activity Type].[Activity Hierarchy].[All]})
示例2没有逗号分隔符,但我们给出了范围
WITH MEMBER Measures.X AS SUM({[User].[column].CURRENTMEMBER},[Measures].[# User Count])
SELECT NON EMPTY
UNION({[User].[column].[ALL]},
Generate(Hierarchize([User].[Column].[ALL])
AS [XL_Filter_Set_0], TopCount(Except(DrilldownLevel([XL_Filter_Set_0].Current
AS [XL_Filter_HelperSet_0],,0,INCLUDE_CALC_MEMBERS), [XL_Filter_HelperSet_0])
, 5, [Measures].[# User Count]))
)DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS , Measures.X ON COLUMNS
FROM [Activity] where
({[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2012]:[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2014]},
{[Activity Type].[Activity Hierarchy].[All]})
此致 南西
答案 0 :(得分:0)
而不是在WHERE
中使用范围尝试使用FROM
from (
select ([Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2012]:[Date].[Fiscal Hierarchy].[Fiscal Year Name].&[2014]) on Columns From [Activity])