单独的时间维度,时间维度本身也是有层次的。

维度-共享层次维度

共享加上时间维度

维度-共享层次维度维度-共享层次维度

 

 创建年月表,主键是[年月]

create Table 年月表     
(
年月 nvarchar(10), 
年 int,
季度 int,
月份 int
)



insert into 年月表(年月,年,季度,月份)
select '2018-01',2018,1,1
union all
select '2018-02',2018,1,2
union all
select '2018-03',2018,1,3
union all
select '2018-04',2018,2,4
union all
select '2018-05',2018,2,5
union all
select '2018-06',2018,2,6
union all
select '2018-07',2018,3,7
union all
select '2018-08',2018,3,8
union all
select '2018-09',2018,3,9
union all
select '2018-10',2018,4,10
union all
select '2018-11',2018,4,11
union all
select '2018-12',2018,4,12



insert into 年月表(年月,年,季度,月份)
select '2019-01',2019,1,1
union all
select '2019-02',2019,1,2
union all
select '2019-03',2019,1,3
union all
select '2019-04',2019,2,4
union all
select '2019-05',2019,2,5
union all
select '2019-06',2019,2,6
union all
select '2019-07',2019,3,7
union all
select '2019-08',2019,3,8
union all
select '2019-09',2019,3,9
union all
select '2019-10',2019,4,10
union all
select '2019-11',2019,4,11
union all
select '2019-12',2019,4,12

 

共享【时间维度】的主键就是年月了

维度-共享层次维度

 

其它Cube调用共享维度的时候外键也必须是这个颗粒度最细的年月

维度-共享层次维度

 

注意,时间维度 年的uniqueMembers是true,季度和月份的uniqueMembers都是false,表示季度同为1季度但是因为年份不一样也是唯一的。

 维度-共享层次维度

 

维度-共享层次维度

 

 

修改后Saiku展示的效果如下:

维度-共享层次维度维度-共享层次维度

 

相关文章:

  • 2021-06-09
  • 2021-10-02
  • 2022-03-06
  • 2021-09-07
  • 2022-12-23
  • 2021-07-02
猜你喜欢
  • 2022-01-21
  • 2021-09-29
  • 2022-01-01
  • 2022-01-06
  • 2022-12-23
  • 2021-05-25
  • 2021-10-05
相关资源
相似解决方案