Pentaho CDF - MDX 查询:显示月份之间的数据(参数)

发布于 2024-11-25 05:38:21 字数 559 浏览 1 评论 0原文

我有两个参数:“从月份”和“到月份”。我想显示这几个月之间的数据。这是我的情况:

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 技术交流群。

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

发布评论

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

评论(1

南笙 2024-12-02 05:38:21

实际上,您会发现如果月份不是同一年,SQL 就不会那么容易了:)

不管怎样,您正在寻找的是这样的东西:

select NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [Markets].Children ON ROWS
from [SteelWheelsSales]
where {([Time].[2003].[QTR1] : [Time].[2004].[QTR2])}

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:

select NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
NON EMPTY [Markets].Children ON ROWS
from [SteelWheelsSales]
where {([Time].[2003].[QTR1] : [Time].[2004].[QTR2])}

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.

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