MDX 对于已存在度量维度修改 语句写法

--MDX 语句写法
--已存在度量  费用A  费用B  费用C 费用D 人次A 人次B
--已存在维度  科室A  科室B  科室C

--求 费用A (费用A+费用B)/人次A 费用C-费用D 人次B
--科室变化:科室A  科室B+C 科室A+C

WITH MEMBER [DeptOrder] AS
[科室].[二级科室].CURRENTMEMBER.PROPERTIES('name')
MEMBER [科室].[二级科室].[科室B+C] as
([科室].[二级科室].[科室B] + [科室].[二级科室].[科室C])
MEMBER [临床科室].[二级科室].[科室A+C ] as
([科室].[二级科室].[科室A] + [科室].[二级科室].[科室C])

MEMBER [费用AB率 ] AS IIF([费用A]+[费用B]=0,NULL,[费用A]+[费用B]/[人次A])
MEMBER [费用CD ] AS ([费用C]/[费用D])

SELECT {
[费用A],
[费用AB率],
[费用CD],
[人次B ]
} ON 0
, NON EMPTY Order({
[科室].[二级科室].[二级科室] 
- [科室].[二级科室].[科室B]
- [科室].[二级科室].[科室C]
, [科室].[二级科室].[科室B+C ]
, [科室].[二级科室].[科室A+C ]
}, [DeptOrder], ASC) ON 1
FROM [Cube_MO]
WHERE ({[日期].[].&[201903],[日期].[].&[201902]}) 

 

posted @ 2019-05-29 11:27  ZHOUZC  阅读(367)  评论(0编辑  收藏  举报