0
我的數據來計算四分位數是這樣的:試圖在MDX
ID |PersonID |CompanyID |DateID |Throughput |AmountType
33F467AC-F35B-4F24-A05B-FC35CF005981 |7 |53 |200802 |3 |0
04EE0FF0-511D-48F5-AA58-7600B3A69695 |18 |4 |201309 |5 |0
AB058AA5-6228-4E7C-9469-55827A5A34C3 |25 |69 |201108 |266 |0
大約有百萬行。列名* ID是指其他表,因此它們可以用作維。
我有一個OLAP多維數據集,其列吞吐量爲度量,其餘爲維度。
我想計算吞吐量度量的四分位數1和3。
我遵循這個指南:https://electrovoid.wordpress.com/2011/06/24/ssas-quartile/ 這個職位一起:Calculating Quartiles in Analysis Services
從這些我試圖用這個MDX查詢:
WITH
SET selection as ([Dates].[Year].&[2014],[Dates].[Month].&[1])
SET [NonEmptyIds] AS
NonEmpty(
[ThroughputID].[ID].[id]
*[ThroughputID].[ID].[Id].ALLMEMBERS
,
{[Measures].[Throughput]} * [selection]
)
SET [ThroughputData] AS
ORDER
(
[NonEmptyIds],
[Measures].[Throughput],
BASC
)
MEMBER [Measures].[RowCount] AS COUNT (ThroughputData)
MEMBER [Measures].[i25] AS (.25 * ([RowCount] - 1)) + 1
MEMBER [Measures].[i25Lo] AS FIX([i25]) - 1
MEMBER [Measures].[i25Rem] AS ([i25] - FIX([i25]))
MEMBER [Measures].[n25Lo] AS (ThroughputData.Item([i25Lo]), [Throughput])
MEMBER [Measures].[n25Hi] AS (ThroughputData.Item([i25Lo] + 1), [Throughput])
MEMBER [Measures].[Quartile1] AS [n25Lo] + ([i25Rem] * ([n25Hi] - [Throughput]))
SELECT
selection ON 0,
[Measures].[Quartile1]
ON 1
FROM (SELECT [Dates].[Y-H-Q-M].MEMBERS ON 0 FROM [Throughput])
,但我得到:「查詢(6,7) ID層次結構在Crossjoin函數中多次使用。'
我是OLAP和MDX的新手。任何想法什麼是錯的,我應該如何計算四分位數是正確的?
我讀的地方,我需要的ID尺寸能夠計算四分位數時,得到一組的所有值,而不是累計值...
順便說一句 - 我認爲你可以簡化這個腳本中擺脫子選擇'從(選擇[日期] [YHQM] .MEMBERS ON 0 FROM [吞吐量]) '只是'從[吞吐量]' – whytheq