MDX COUNT ON DIMENSION

时间:2015-03-23 07:37:22

标签: count mdx dimensions

我有一个mdx查询,它可以为我提供明确的开斋节,地区和国家/地区:

SELECT ([Measures].[Active Tiles Count]) ON 0,
NON EMPTY ([Employee].[Employee Id].Children,[Employee - Business Region].  [Region Code].Children,[Employee - Country].[Country Code].Children) ON 1
FROM [OLAP Pre]
WHERE ( 
{[Employee Statuses].[Status Id].&[1],[Employee Statuses].[Status Id].&[4],[Employee Statuses].[Status Id].&[3]},
{[Business Region].[Abbreviation].&[APJ],[Business Region].[Abbreviation].&[EMEA],[Business Region].[Abbreviation].&[Americas]},
{[Employee Types].[Bits].&[1],[Employee Types].[Bits].&[9],
[Employee Types].[Bits].&[25],[Employee Types].[Bits].&[5],
[Employee Types].[Bits].&[13],[Employee Types].[Bits].&[29]}
,{[Date].[Date].&[2015-03-18T00:00:00]:NULL})

但我希望 COUNT DISTINCT (employEEid))按地区和国家/地区分组。
怎么做?

2 个答案:

答案 0 :(得分:1)

创建DISTINCT COUNT MEASURE,它是预定义的聚合类型

答案 1 :(得分:0)

尝试使用DISTINCTCOUNT功能

WITH MEMBER Measures.[CountOfDistinctEmployes] AS
DISTINCTCOUNT([Employee].[Employee Id].Children)

SELECT {[Measures].[Active Tiles Count], Measures.[CountOfDistinctEmployes]} ON 0,
NON EMPTY ([Employee].[Employee Id].Children,[Employee - Business Region].  [Region Code].Children,[Employee - Country].[Country Code].Children) ON 1
FROM [OLAP Pre]
WHERE ( 
{[Employee Statuses].[Status Id].&[1],[Employee Statuses].[Status Id].&[4],[Employee Statuses].[Status Id].&[3]},
{[Business Region].[Abbreviation].&[APJ],[Business Region].[Abbreviation].&[EMEA],[Business Region].[Abbreviation].&[Americas]},
{[Employee Types].[Bits].&[1],[Employee Types].[Bits].&[9],
[Employee Types].[Bits].&[25],[Employee Types].[Bits].&[5],
[Employee Types].[Bits].&[13],[Employee Types].[Bits].&[29]}
,{[Date].[Date].&[2015-03-18T00:00:00]:NULL})