MDX 逐月同比销售额

发布于 2024-08-24 13:43:52 字数 587 浏览 1 评论 0原文

我陷入了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖兔^ω^ 2024-08-31 13:43:52

选择 {[时间].[2009], [时间].[2010]} ON 0,
[时间].[月].会员 ON 1
FROM [Your Cube Name] WHERE [Measures].[Sales]

我基于这个查询(如下),我在 Miscrosoft 的 Adventure Works 示例多维数据集中进行了测试:

SELECT {[Ship Date].[Fiscal Year].&[2002], [Ship Date].[Fiscal Year].&[2003]} ON 0,
[Ship Date].[Month of Year].Members ON 1
FROM [Adventure Works] WHERE [Measures].[Sales Amount]

更新:

根据您的查询,我不确定为什么会这样无需在多维数据集查询上指定层次结构即可工作(例如 [Time].[2010] 而不是 [Time].[Hierarchy Name].[2010]),但是您可以尝试一下吗:

SELECT EXISTS([Time].Members, {[Time].[2009], [Time].[2010]}) ON COLUMNS, 
[Time].[Months].Members ON ROWS 
FROM [SalesProductIndicator] WHERE [Measures].[Sales] 

谢谢

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:

SELECT {[Ship Date].[Fiscal Year].&[2002], [Ship Date].[Fiscal Year].&[2003]} ON 0,
[Ship Date].[Month of Year].Members ON 1
FROM [Adventure Works] WHERE [Measures].[Sales Amount]

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:

SELECT EXISTS([Time].Members, {[Time].[2009], [Time].[2010]}) ON COLUMNS, 
[Time].[Months].Members ON ROWS 
FROM [SalesProductIndicator] WHERE [Measures].[Sales] 

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文