MDX 逐月同比销售额
我陷入了 MDX 查询,我试图检索以下结果:
[Time].[2009] [Time].[2010]
[Time].[Months].Members [Measures].[Sales] [Measures].[Sales]
所以我想按月比较 2009 年和 2010 年的销售额。
就图表而言,我有两个系列,一个是 2009 年和 2010 年,y 轴是销售额,x 轴是月份。
我的查询如下所示:
SELECT {[Time].[2009], [Time].[2010]} ON COLUMNS,
[Time].[Months].Members ON ROWS
FROM [SalesProductIndicator] WHERE [Measures].[Sales]
它给了我这个错误:
Mondrian Error:Dimension '[Time]' appears in more than one independent axis.
提前致谢
I'm stuck on a MDX query, I'm trying to retrieve the following results:
[Time].[2009] [Time].[2010]
[Time].[Months].Members [Measures].[Sales] [Measures].[Sales]
So I would like to compare the sales which were in 2009 against 2010 by month.
In terms of a chart I would have two series one for 2009 and 2010, the y axis would be the sales value and the x axis would be the month.
My query looks like this:
SELECT {[Time].[2009], [Time].[2010]} ON COLUMNS,
[Time].[Months].Members ON ROWS
FROM [SalesProductIndicator] WHERE [Measures].[Sales]
It gives me this error:
Mondrian Error:Dimension '[Time]' appears in more than one independent axis.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
选择 {[时间].[2009], [时间].[2010]} ON 0,
[时间].[月].会员 ON 1
FROM [Your Cube Name] WHERE [Measures].[Sales]
我基于这个查询(如下),我在 Miscrosoft 的 Adventure Works 示例多维数据集中进行了测试:
更新:
根据您的查询,我不确定为什么会这样无需在多维数据集查询上指定层次结构即可工作(例如 [Time].[2010] 而不是 [Time].[Hierarchy Name].[2010]),但是您可以尝试一下吗:
谢谢
SELECT {[Time].[2009], [Time].[2010]} ON 0,
[Time].[Months].Members ON 1
FROM [Your Cube Name] WHERE [Measures].[Sales]
I based that on this query (below) that I've tested on the Adventure Works sample cube from Miscrosoft:
UPDATE:
Based on your query I'm not sure why it is working without specifiying a hierarchy on your cube query (like [Time].[2010] instead of [Time].[Hierarchy Name].[2010]) but could you try this:
Thanks