Pentaho CDF - MDX 查询:显示月份之间的数据(参数)
我有两个参数:“从月份”和“到月份”。我想显示这几个月之间的数据。这是我的情况:
with member [Measures].[Ordercount Y-1] as '([Year].PrevMember, [Measures].[Ordercount])'
member [Measures].[Growth] as IIF([Measures].[Ordercount Y-1] >0,
[Measures].[Ordercount]/[Measures].[Ordercount Y-1] *100,0)
select {[Measures].[Growth]} ON COLUMNS,
NON EMPTY {[Year].[" +year+ "]} ON ROWS
from [Ordercube]
它是一个拨号图,我想显示与去年相比的销售额百分比以及月份之间的范围。
在 SQL 中,这很容易:其中 Month >= frommonth 且 Month <= tomonth。 由于您只能在 MDX 查询中切片一次,我不知道该怎么做。 我希望有人能帮助我。
提前致谢
I have two parameters: 'from month' and 'to month'. I would like to show data between those months. This is my situation:
with member [Measures].[Ordercount Y-1] as '([Year].PrevMember, [Measures].[Ordercount])'
member [Measures].[Growth] as IIF([Measures].[Ordercount Y-1] >0,
[Measures].[Ordercount]/[Measures].[Ordercount Y-1] *100,0)
select {[Measures].[Growth]} ON COLUMNS,
NON EMPTY {[Year].[" +year+ "]} ON ROWS
from [Ordercube]
Its a dialchart, I want to show the % of sales compared to last year in combination with a range between months.
In SQL it would be easy: Where month >= frommonth and month <= tomonth.
Since you can only slice once in a MDX query I don't know what to do.
I hope someone can help me.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,您会发现如果月份不是同一年,SQL 就不会那么容易了:)
不管怎样,您正在寻找的是这样的东西:
This query was write against pentaho's data Warehouse 。我对您的数据仓库是什么样子一无所知,所以我不知道在查询的时间维度中使用什么,但它是 ([Time].[2003].[QTR1] : [Time]. [2004].[QTR2]) 我认为您正在寻找的语法。
(免责声明:我是 CDF 核心开发人员之一,但我的 MDX 很糟糕)
编辑:在这种特殊情况下(范围运算符参考)参考站点不是特别明确,但是 MDX 的 MSDN 参考站点非常好,所以这里是一般的MDX 参考站点。
Actually, you'd find that SQL wouldn't be quite as easy if the months weren't both in the same year :)
Either way, what you're looking for is something like this:
This query was written against pentaho's data warehouse. I haven't the faintest clue what your data wharehouse looks like so I don't know what to use in the time dimension for your query, but it's the ([Time].[2003].[QTR1] : [Time].[2004].[QTR2]) syntax you're looking for, I think.
(disclaimer: I'm one of the CDF core developers, but my MDX sucks)
EDIT: In this particular case (Range Operator Reference) the reference site isn't particularly explicit, but the MSDN reference site for MDX is pretty good, so here's the general MDX Reference Site.