我正在試圖計算一個立方體中的百分位數(例如我的測量值的第90個百分點),我想我已經差不多了。我面臨的問題是,我能夠返回第90百分位數的行數,但不知道如何得到我的度量。計算SSAS中的百分位值
With
Member [Measures].[cnt] as
Count(NonEmpty(
-- dimensions to find percentile on (the same should be repeated again
[Calendar].[Hierarchy].members *
[Region Dim].[Region].members *
[Product Dim].[Product].members
,
-- add the measure to group
[Measures].[Profit]))
-- define percentile
Member [Measures].[Percentile] as 90
Member [Measures].[PercentileInt] as Int((([Measures].[cnt]) * [Measures].[Percentile])/100)
**-- this part finds the tuple from the set based on the index of the percentile point and I am using the item(index) to get the necessary info from tuple and I am unable to get the measure part
Member [Measures].[PercentileLo] as
(
Order(
NonEmpty(
[Calendar].[Hierarchy].members *
[Region Dim].[Region].members *
[Product Dim].[Product].members,
[Measures].[Profit]),
[Measures].[Profit].Value, BDESC)).Item([Measures].[PercentileInt]).Item(3)**
select
{
[Measures].[cnt],
[Measures].[Percentile],[Measures].[PercentileInt],
[Measures].[PercentileLo],
[Measures].[Profit]
}
on 0
from
[TestData]
我認爲必須有一種方法來獲得通過集合的索引找到的元組度量。請幫助,讓我知道你是否需要更多信息。謝謝!
這樣嗎?會員[措施]。[PercentileLo]爲Order( 非空( [日曆]。[層次] .members * [地區節電]。[區域] .members * [產品節電]。[產品] .members, [措施]。[利潤]), [措施]。[利潤]。價值,BDESC))。項目([措施]。[PercentileInt]) – Prashant
嘗試此並且不起作用。 – Prashant
@Prashant你是什麼意思是「不起作用」?只用這句話,我不知道如何改進我的答案。你有錯誤信息嗎?它說什麼?它是否運行,但給出的價值不像您期望的那樣?如果是這樣,你期望什麼,返回的價值是多少? – FrankPl