环比

WITH
MEMBER [Measures].[销售台次当月计划] AS ([日期].[年-月-日].parent,([目标类型].[目标类型名称].&[财务精品收入],[Measures].[门店月目标值]))

MEMBER [Measures].[本月收入] AS iif(sum(mtd([日期].[年-月-日]),(iif([Measures].[财务精品收入]=null,0,[Measures].[财务精品收入])))=0,null,sum(mtd([日期].[年-月-日]),(iif([Measures].[财务精品收入]=null,0,[Measures].[财务精品收入])))) 

MEMBER [Measures].[销售台次当月累计] AS [Measures].[本月收入]   

MEMBER [Measures].[上月当日销售台次合计] AS (PARALLELPERIOD( [日期].[年-月-日].[月],1,[日期].[年-月-日]),[Measures].[财务精品收入])  

MEMBER [Measures].[上年当日销售台次合计] AS (PARALLELPERIOD( [日期].[年-月-日].[年],1, [日期].[年-月-日] ),[Measures].[财务精品收入])  

MEMBER [Measures].[上月月累计销售台次合计] AS iif(sum(mtd([日期].[年-月-日]),(iif([Measures].[上月当日销售台次合计]=null,0,[Measures].[上月当日销售台次合计])))=0,null,sum(mtd([日期].[年-月-日]),(iif([Measures].[上月当日销售台次合计]=null,0,[Measures].[上月当日销售台次合计])))) 

MEMBER [Measures].[上年月累计销售台次合计] AS iif(sum(mtd([日期].[年-月-日]),(iif([Measures].[上年当日销售台次合计]=null,0,[Measures].[上年当日销售台次合计])))=0,null,sum(mtd([日期].[年-月-日]),(iif([Measures].[上年当日销售台次合计]=null,0,[Measures].[上年当日销售台次合计]))))

MEMBER [Measures].[同比增长] AS  iif([Measures].[上年月累计销售台次合计]=0,null,iif([Measures].[销售台次当月累计]=0,-1,[Measures].[销售台次当月累计]/[Measures].[上年月累计销售台次合计]-1)) 

MEMBER [Measures].[环比增长] AS iif([Measures].[上月月累计销售台次合计]=0,null,iif([Measures].[销售台次当月累计]=0,-1,[Measures].[销售台次当月累计]/[Measures].[上月月累计销售台次合计]-1)) 

MEMBER [Measures].[当月累计达成率] AS

iif([Measures].[销售台次当月累计]=0 or [Measures].[销售台次当月计划]=0,null,[Measures].[销售台次当月累计]/[Measures].[销售台次当月计划])

SELECT 

[Measures].[上年月累计销售台次合计], [Measures].[同比增长], [Measures].[环比增长], [Measures].[当月累计达成率],

[Measures].[上月月累计销售台次合计], [Measures].[销售台次当月计划], [Measures].[销售台次当月累计] } ON COLUMNS,

NON EMPTY { ([门店信息].[管辖区域].MEMBERS ) } on 1

from [KPI]where [日期].[年-月-日].[年].&[2010].&[10].&[2010-10-31T00:00:00]

WITH
MEMBER [Measures].[本月整车销售台次] AS [Measures].[销售量]

MEMBER [Measures].[前一月整车销售台次] AS ([Measures].[本月整车销售台次],ParallelPeriod ([日期].[年-月].[月] , 1,[日期].[年-月]))

MEMBER [Measures].[前两月整车销售台次] AS ([Measures].[本月整车销售台次],ParallelPeriod ([日期].[年-月].[月],2, [日期].[年-月]))

MEMBER [Measures].[去年当月整车销售台次] AS ([Measures].[本月整车销售台次],ParallelPeriod ([日期].[年-月].[年],1,[日期].[年-月]))

MEMBER [Measures].[本年累计整车销售台次] AS iif(sum(ytd([日期].[年-月]),(iif([Measures].[销售量]=null,0,[Measures].[销售量])))=0,null,sum(ytd([日期].[年-月]),(iif([Measures].[销售量]=null,0,[Measures].[销售量]))))

MEMBER [Measures].[去年累计整车销售台次] AS iif(sum(ytd([日期].[年-月]),(iif([Measures].[去年当月整车销售台次]=null,0,[Measures].[去年当月整车销售台次])))=0,null,sum(ytd([日期].[年-月]),(iif([Measures].[去年当月整车销售台次]=null,0,[Measures].[去年当月整车销售台次]))))  

MEMBER [Measures].[当月计划整车销售台次] AS ([目标类型].[目标类型名称].&[总销量],[Measures].[门店月目标值]) MEMBER [Measures].[当年计划整车销售台次] AS ([日期].[年-月].parent,([目标类型].[目标类型名称].&[总销量],[Measures].[门店年目标值]))

MEMBER [Measures].[当年月累加计划整车销售台次] AS iif(sum(ytd([日期].[年-月]),(iif([Measures].[当月计划整车销售台次]=null,0,[Measures].[当月计划整车销售台次])))=0,null,sum(ytd([日期].[年-月]),(iif([Measures].[当月计划整车销售台次]=null,0,[Measures].[当月计划整车销售台次])))) 


SELECT

{ [Measures].[当月计划整车销售台次], [Measures].[去年累计整车销售台次], [Measures].[当年月累加计划整车销售台次], [Measures].[当年计划整车销售台次],
[Measures].[本年累计整车销售台次], [Measures].[前两月整车销售台次], [Measures].[前一月整车销售台次], [Measures].[本月整车销售台次], [Measures].[去年当月整车销售台次] } ON COLUMNS

FROM [KPI] where [日期].[年-月].[年].&[2010].&[8]


 

posted @ 2011-02-23 10:12  emmy  阅读(317)  评论(0编辑  收藏  举报