单日计算,以 MDX 形式,开始日期和结束日期位于事实表中
我有一个 ssas 多维数据集,其事实表包含:
- FactID
- Status
- StartDate
- EndDate
日期链接到日期维度(状态到状态维度)。
我试图获得一份报告,显示两周内每天某个状态的事实数量,例如:
01 May 2011, 02 May 2011, 03 May 2011 etc...
status1 300 310 320 ...
status2 250 240 265 ...
status3 125 546 123 ...
我可以使用以下命令获取单日的数据:
select
{
[TOTAL NUMBER FACT]
} on 0
,{
descendants([DIM STATUS].[STATUS DESCRIPTION])
} on 1
from [DW_CUBE]
WHERE
([DIM HISTORY START DATE].[YEAR MONTH DAY].FirstMember:[DIM HISTORY START DATE].[YEAR MONTH DAY].&[20110501],
[DIM HISTORY END DATE].[YEAR MONTH DAY].&[20110501]:[DIM HISTORY END DATE].[YEAR MONTH DAY].LastMember)
但是我是否可以让它工作超过一个时间天?
非常非常感谢
I have a ssas cube with the fact table containing:
- FactID
- Status
- StartDate
- EndDate
the dates are linked to a date dimension (status to the status dimension).
Im trying to get a report that shows the amount of facts at a status on each day over a two week period, eg:
01 May 2011, 02 May 2011, 03 May 2011 etc...
status1 300 310 320 ...
status2 250 240 265 ...
status3 125 546 123 ...
I can obtain the data for a single day using the following:
select
{
[TOTAL NUMBER FACT]
} on 0
,{
descendants([DIM STATUS].[STATUS DESCRIPTION])
} on 1
from [DW_CUBE]
WHERE
([DIM HISTORY START DATE].[YEAR MONTH DAY].FirstMember:[DIM HISTORY START DATE].[YEAR MONTH DAY].&[20110501],
[DIM HISTORY END DATE].[YEAR MONTH DAY].&[20110501]:[DIM HISTORY END DATE].[YEAR MONTH DAY].LastMember)
but do i get this working for more than a single day?
Many many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看以下链接:
http: //www.bp-msbi.com/2010/10/avoiding-multiple-role-playing-date-dimensions/
http://cwebbbi.wordpress.com/2011/01/21/solving-the-events- in-progress-problem-in-mdx-part-1/
简而言之,您可以使用 MDX 与 LinkMember 一起执行此操作,或者如果您正在对正在进行的事件进行计数 - 从时间开始到现在进行计数并减去一个事件来自另一个事件。
您还可以通过建模来解决问题 - 在我的帖子中通过旋转以及在克里斯的后续角色扮演测量组中。
Have a look at the following links:
http://www.bp-msbi.com/2010/10/avoiding-multiple-role-playing-date-dimensions/
http://cwebbbi.wordpress.com/2011/01/21/solving-the-events-in-progress-problem-in-mdx-part-1/
In brief, you can use MDX to do this with LinkMember, or if you are counting events in progress - with counting from begin of time till now and subtracting one event from another.
You can also solve the problem with modelling - in my post by pivoting and in Chris's follow-up with role-playing measure groups.