【问题标题】:MDX COUNT ON DIMENSIONMDX 尺寸计算
【发布时间】:2015-03-23 07:37:21
【问题描述】:

我有一个 mdx 查询,它可以为我提供不同的 eid、地区和国家/地区:

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))。
如何做到这一点?

【问题讨论】:

    标签: count mdx dimensions


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      尝试使用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})
      

      【讨论】:

        猜你喜欢
        • 2010-09-19
        • 2021-12-14
        • 1970-01-01
        • 1970-01-01
        • 2013-10-10
        • 2019-11-24
        • 1970-01-01
        • 1970-01-01
        • 2021-08-28
        相关资源
        最近更新 更多