2
我有兩個維度,分別稱爲[Session Length]
和[Date]
,以及我的Cube中稱爲[Count - Logins]
的度量。 [Session Length]
維包含一個名爲[Session Length]
的屬性,其成員是從0
到240
的整數。創建自定義的MDX命名集合
我喜歡寫MDX查詢該會集結[Count - Logins]
在[Session Length]
尺寸定製的子集(即我想創建一個基於[Session Length]
尺寸定製的集並聚集在這個組自定義的單個成員的數量)。下面是該查詢我來了這麼遠,但不幸的是我不知道如何前進:
WITH SET [Description] AS {
[SessionLength].[Session Length].&[0], //Glimpse
[SessionLength].[Session Length].&[1]:[SessionLength].[Session Length].&[5], //Short
[SessionLength].[Session Length].&[6]:[SessionLength].[Session Length].&[30], //Medium
[SessionLength].[Session Length].&[31]:[SessionLength].[Session Length].&[90], //Long
[SessionLength].[Session Length].&[90]:[SessionLength].[Session Length].&[240]} //Extended
MEMBER [SessionLength].[Session Length].SessionDescription AS
Aggregate([Description])
SELECT
{ [Measures].[Count - Logins] }
ON COLUMNS,
NONEMPTY({[SessionLength].[Session Length].SessionDescription} * {[Date].[Date].[Date]}) ON ROWS
FROM MyCube
具有下列樣品結果集:
Session Length | Date | Count - Logins
-------------------------------------------------
SessionDescription | 2014-02-01 | 22
SessionDescription | 2014-02-01 | 17
正如你所看到的計數被整個集合而不是每個成員單獨聚合。這裏是我希望產生的結果:
Session Length | Date | Count - Logins
-------------------------------------------------
Glimpse | 2014-02-01 | 3
Short | 2014-02-01 | 4
Medium | 2014-02-01 | 9
Long | 2014-02-01 | 5
Extended | 2014-02-01 | 1
Glimpse | 2014-02-02 | 2
Short | 2014-02-02 | 5
Medium | 2014-02-02 | 7
Long | 2014-02-02 | 2
Extended | 2014-02-02 | 1
任何幫助,將不勝感激。我知道這可以通過修改DSV來實現,但我不想改變Cube的結構。