MDX:集合上的聚合
我想要实现的目标看起来很简单,但我无法使其发挥作用。 我的事实是带有日期的订单,并且我有一个典型的时间维度,包括“月”和“年”级别。
我希望获得一个输出,其中列出了过去 6 个月的订单数和总数,如下所示:
Oct 2009 20 Nov 2009 30 Dec 2009 25 Jan 2009 15 Feb 2010 45 Mar 2010 5 Total 140
我可以在 2009 年 10 月到 2010 年 3 月期间与成员一起创建该集合,并且我设法获得了我想要的输出的这一部分:
Oct 2009 20 Nov 2009 30 Dec 2009 25 Jan 2009 15 Feb 2010 45 Mar 2010 5
只是我无法获得总行。
What I am trying to achieves looks very simple, yet I cannot make it work.
My facts are orders which have a date and I have a typical time dimension with the 'Month" and 'Year' levels.
I would like to get an output which lists the number of orders for the last 6 months and the total, like this:
Oct 2009 20 Nov 2009 30 Dec 2009 25 Jan 2009 15 Feb 2010 45 Mar 2010 5 Total 140
I can create the set with the members Oct 2009 until Mar 2010 and I manage to get this part of my desired output:
Oct 2009 20 Nov 2009 30 Dec 2009 25 Jan 2009 15 Feb 2010 45 Mar 2010 5
Just I fail to get the total line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过将 ALL 成员添加到集合中,然后将其全部包装在 VisualTotals() 函数中来实现此目的
You can achieve this by adding the ALL member to the set and then wrapping it all in the VisualTotals() function
这是 Adventure Works DW Demo Cube 的一种可能的解决方案。该查询选择最后 6 个订单计数并在日期维度上添加总和:
here is one possible solution for Adventure Works DW Demo Cube. The query selects the last 6 Order Counts and add a sum on the date dimension: