简体   繁体   English

如何在MDX的层次结构中查找每个组的总和

[英]How to find sum of each group in Hierarchy in MDX

In the example below I want to find sum of each group. 在下面的示例中,我想找到每个组的总和。 Can someone correct my MDX query to get the desired result for GroupCount Column. 有人可以更正我的MDX查询以获得GroupCount Column的所需结果。

with member [GroupCount] as
aggregate([Department].[Department ID].currentmember.parent,
          [Measures].[Pay Frequency])


select {[Department].[Group Name].[all].children*
        [Department].[Department ID].[all].children
       } on rows,
{[Measures].[Pay Frequency],[GroupCount]} on columns
from test

The result I am getting from the above query is: 我从上面的查询中得到的结果是:

在此处输入图片说明

However I need the output as : 但是我需要输出为:

在此处输入图片说明

Is it like this? 像这样吗

with member [GroupCount] as
(
     [Department].[Group Name].CURRENTMEMBER,
     [Department].[Department ID].[All],
     [Measures].[Pay Frequency]
)
select {[Department].[Group Name].[all].children*
        [Department].[Department ID].[all].children
       } on rows,
{[Measures].[Pay Frequency],[GroupCount]} on  columns
from test;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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