我具有以下具有日期和时间范围的事件事实表,我想选择特定日期和以小时为单位的DayOfweek中的预定事件计数,我尝试使用Cube浏览器进行此操作,但是没有办法我需要使用哪种mdx查询?
ID_EVENT Date_From Date_To ID_Schedule DayWeek Time_From Time_To
1780 98-01-08 98-03-22 3420 6 10:30:00 13:00:00
1780 98-01-08 98-03-22 3422 7 09:30:00 12:00:00
1780 98-01-08 98-03-22 3423 7 09:30:00 12:00:00
1781 98-01-05 98-04-10 3424 1 15:30:00 18:00:00
1781 98-01-05 98-04-10 3430 3 18:30:00 21:00:00
1781 98-01-05 98-04-10 3431 3 19:00:00 21:15:00
1781 98-01-05 98-04-10 3432 4 15:30:00 19:00:00
1781 98-01-05 98-04-10 3433 4 15:30:00 20:00:00
1441 98-01-24 98-03-28 2909 6 09:00:00 10:30:00
1442 98-01-25 98-03-29 2910 7 09:00:00 10:30:00
1443 98-01-24 98-03-28 2911 6 10:45:00 12:15:00
1444 98-01-25 98-03-29 2912 7 10:45:00 12:15:00
我想要以下输出:
Date Heure Nbr_seance
98-01-10 10:00 1
98-01-10 11:00 1
98-01-10 12:00 1
98-01-10 13:00 1
98-01-17 10:00 1
98-01-17 11:00 1
98-01-17 12:00 1
98-01-17 13:00 1
98-01-24 10:00 1
98-01-24 11:00 1
98-01-24 12:00 1
98-01-24 13:00 1
98-01-11 09:00 1
98-01-11 10:00 1
98-01-11 11:00 1
98-01-11 12:00 1
...
谢谢
答案 0 :(得分:1)
//for a particular date and day of week
select [measures].[countOfSchedule] on 0,
non empty
([Dim Date].[Date].[2019-04-09],[Dim Date].[DayOfWeek].[2],[Dim Date].[Hour].[Hour])
on 1
from
[YourCube]
//Returns the day 2 of each week, in a date range
select [measures].[countOfSchedule] on 0,
non empty
({[Dim Date].[Date].[2019-03-01]:[Dim Date].[Date].[2019-04-01]},
[Dim Date].[DayOfWeek].[2],[Dim Date].[Hour].[Hour])
on 1
from
[YourCube]
更新MDX中between子句的示例
with member
measures.startdate
as
CDate([DimStartdate].[Date].currentmember.name)
member measures.enddate
as
CDate([DimEnddate].[Date].currentmember.name)
select
{[Measures].[Internet Sales Amount], measures.startdate,measures.enddate }
on columns,
filter
(([DimStartdate].[Date].[2018/08/20]:[DimStartdate].[Date].[2018/12/20],
[DimEnddate]。[Date]。[2018/08/20]:[DimEnddate]。[Date]。[2018/12/20]), CDate(“ 2018/9/5”)> measure.startdate和CDate(“ 2018/10/5”)