我找到了一种方法,可以通过一系列步骤打破计算,从而获得了一个非常快速的解决方案 .
为了计算表 Data 中 Amount Paid 的第10个百分位数,我遵循了下面的书外公式:
Calculate the Ordinal rank for the 10th percentile element
10ptOrdinalRank:=0.10*(COUNTX('Data', [Amount Paid]) - 1) + 1
它可能会出现一个十进制(分数)数字,如112.45
Compute the decimal part
10ptDecPart:=[10ptOrdinalRank] - TRUNC([10ptOrdinalRank])
Compute the ordinal rank of the element just below(floor)
10ptFloorElementRank:=FLOOR([10ptOrdinalRank],1)
Compute the ordinal rank of the element just above(ceiling)
10ptCeilingElementRank:=CEILING([10ptOrdinalRank], 1)
Compute element corresponding to floor
10ptFloorElement:=MAXX(TOPN([10ptFloorElementRank], 'Data',[Amount Paid],1), [Amount Paid])
Compute element corresponding to ceiling
10ptCeilingElement:=MAXX(TOPN([10ptCeilingElementRank], 'Data',[Amount Paid],1), [Amount Paid])
Compute the percentile value
10thPercValue:=[10ptFloorElement] + [10ptDecPart]*([10ptCeilingElement]-[10ptFloorElement])
我发现性能明显快于我在网上找到的其他解决方案 . 希望它能帮助将来的某个人 .