这里MDX衡量客户是我招:通过分类计数优化
CREATE MEMBER CURRENTCUBE.[Measures].[ContactNumber] AS
nonempty(
UNORDER(
(UNORDER([Contact].[Contact Id].[Contact Id].MEMBERS)
,{linkmember([Period].[Per Quarter].currentmember,[Period Ending].[Per Quarter]).NextMember : STRTOMEMBER('TAIL([Period Ending].[Per Quarter].[' + [Period].[Per Quarter].currentmember.LEVEL.name +'],1)(0)')}
,{NULL :[Period].[Per Quarter].currentmember}
,[Category].[Category].currentmember)
)
,[MAX_BeginDate]
).count
它给了我多少钱的客户中有一类以期
我的事实表喜欢
contact periodin periodout category
A 25 26 cat1
A 26 27 cat2
A 27 end cat3
B 1 26 cat0
B 26 end cat1
C 1 2 cat2
C 3 4 cat2
C 4 end cat3
而我的尺寸:
Period regular by periodin
Period ending regular by periodout
contact regular by contact
category regular by category
所以对于26日,我将有:
cat0 0
cat1 1(B)
cat2 1(A)
cat3 1(C)
如果有人认为明显改善...... 它tooks我过1分钟,1min30所有4categories在2017年有一天,有超过100个表中的数百万行。每个客户至少有1件事。日历始于2000年,有6000万的客户。
谢谢
问候 Antho