前提:时段维表,指标
一、新建数据项sd_first、sd_second,其值分别为:item(topCount([时段],2,[总流量]),0)、item(topCount([时段],2,[总流量]),1),获得总流量最大和次大的时间段
二、新建数据项sd_first总流量、sd_second总流量,其值分别为value(tuple(item(topCount([时段],2,[总流量]),0),[总流量]))、value(tuple(item(topCount([时段],2,[总流量]),1),[总流量])),获得最大和次大时间段对应的指标值
三、如果有多个指标可以重复上面的,多个指标的情况下用case when有时起作用有时不起作用,醉人。其中index_ind是用只提示做的可以选择多个指标,0,1,...,6分别代表不同指标,指标不同时间段不同。注意需要用caption,负责时间段显示不出来
IF ( ?index_ind?=0 ) THEN
(caption([sd_first) )
ELSE
(IF ( ?index_ind?=1 ) THEN
(caption([sd_first本地大]) )
ELSE
( IF ( ?index_ind?=2 ) THEN
(caption([sd_first本地小]) )
ELSE
( IF ( ?index_ind?=3 ) THEN
(caption([sd_first本省大]) )
ELSE
(IF ( ?index_ind?=4 ) THEN
(caption([sd_first本省小]) )
ELSE
( IF ( ?index_ind?=5 ) THEN
(caption([sd_first外省大]) )
ELSE
( caption([sd_first外省小]))) ))) )
四、时间段对应的指标值
IF ( ?index_ind?=0 ) THEN
(([sd_first总流量]) )
ELSE
(IF ( ?index_ind?=1 ) THEN
(([sd_firstindex本地大]) )
ELSE
( IF ( ?index_ind?=2 ) THEN
(([sd_firstindex本地小]) )
ELSE
( IF ( ?index_ind?=3 ) THEN
(([sd_firstindex本省大]) )
ELSE
(IF ( ?index_ind?=4 ) THEN
(([sd_firstindex本省小]) )
ELSE
( IF ( ?index_ind?=5 ) THEN
(([sd_firstindex外省大]) )
ELSE
( ([sd_firstindex外省小]))) ))) )
ok,烦人的是if else嵌套太多,但是在用case when时有些起作用,有些就失效!