Fractile - 圖表函數
Fractile() 會找出對應於圖表維度上反覆運算的運算式指定範圍內彙總資料的 fractile (分位數) 的值。
Syntax:
Fractile([{SetExpression}] [DISTINCT] [TOTAL [<fld{, fld}>]] expr, fraction)
Return data type: 數值
Arguments:
引數 | 描述 |
---|---|
expr | 包含待測量資料的運算式或欄位。 |
fraction | 介於 0 和 1 之間的數字對應於要計算的 fractile (表示為分數的分位數)。 |
SetExpression | 依照預設,彙總函數將彙總選項所定義的一組可能記錄。集合分析運算式可定義一組替代的記錄。 |
DISTINCT | 如果 DISTINCT 這個字出現在函數引數之前,會忽略評估函數引數所產生的重複項目。 |
TOTAL |
如果 TOTAL 這個字出現在函數引數之前,會計算已指定目前選項的所有可能值,而不僅是與目前維度值相關的值,也就是說,會忽略圖表維度。 TOTAL 限定詞後面可以加上以角括弧 |
Limitations:
除非內部彙總包含 TOTAL 限定詞,否則運算式不可包含彙總函數。 如需更進階的巢狀彙總,請使用進階彙總函數 Aggr 結合計算維度。
Examples and results:
Customer | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Astrida | 46 | 60 | 70 | 13 | 78 | 20 | 45 | 65 | 78 | 12 | 78 | 22 |
Betacab | 65 | 56 | 22 | 79 | 12 | 56 | 45 | 24 | 32 | 78 | 55 | 15 |
Canutility | 77 | 68 | 34 | 91 | 24 | 68 | 57 | 36 | 44 | 90 | 67 | 27 |
Divadip | 57 | 36 | 44 | 90 | 67 | 27 | 57 | 68 | 47 | 90 | 80 | 94 |
範例 | 結果 |
---|---|
|
A chart with dimension = |
|
71.75 (對於所有 Customer 值),因為 |
|
總計 70,因為使用 |
範例中使用的資料:
Monthnames:
LOAD * INLINE [
Month, Monthnumber
Jan, 1
Feb, 2
Mar, 3
Apr, 4
May, 5
Jun, 6
Jul, 7
Aug, 8
Sep, 9
Oct, 10
Nov, 11
Dec, 12
];
Sales2013:
crosstable (Month, Sales) LOAD * inline [
Customer|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
Astrida|46|60|70|13|78|20|45|65|78|12|78|22
Betacab|65|56|22|79|12|56|45|24|32|78|55|15
Canutility|77|68|34|91|24|68|57|36|44|90|67|27
Divadip|57|36|44|90|67|27|57|68|47|90|80|94
] (delimiter is '|');
若要取得按正確順序排序的月份,請在建立圖表時前往圖表屬性的 Sort 標籤,並勾選 Sort by 下的 Expression 核取方塊。在運算式方塊中,寫入 Monthnumber。