

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 樞紐分析表計算函數
<a name="supported-functions"></a>

您可以在樞紐分析表計算中使用下列函數。

**Topics**
+ [累計加總](#running-total)
+ [差異](#difference)
+ [百分比差異](#percent-difference)
+ [總計百分比](#percent-of-total)
+ [Rank](#rank)
+ [百分位數](#percentile)

您可以將列出的函數套用至下列資料：

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/running-total1.png)


![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/running-total1.png)


## 累計加總
<a name="running-total"></a>

**Running total (累計加總)** 函數計算特定儲存格值及其之前所有儲存格的值的總和。此總和的計算方式為 `Cell1=Cell1, Cell2=Cell1+Cell2, Cell3=Cell1+Cell2+Cell3`，依此類推。

對表格列套用 **Running total (累計加總)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/running-total2.png)


## 差異
<a name="difference"></a>

**Difference (差異)** 函數計算儲存格值及其前一儲存格的值之間的差異。此差異的計算方式為 `Cell1=Cell1-null, Cell2=Cell2-Cell1, Cell3=Cell3-Cell2,`，依此類推。由於 `Cell1-null = null`，Cell1 值一律是空的。

對表格列套用 **Difference (差異)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/difference.png)


## 百分比差異
<a name="percent-difference"></a>

**Percentage Difference (百分比差異)** 函數計算儲存格值及其前一儲存格的值之間的差異，再除以其前一儲存格的值而得出百分比。此值的計算方式為 `Cell1=(Cell1-null)/null, Cell2=(Cell2-Cell1)/Cell1, Cell3=(Cell3-Cell2)/Cell2,`，依此類推。由於 `(Cell1-null)/null = null`，Cell1 值一律是空的。

對表格列套用 **Percentage Difference (百分比差異)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/percentage-difference.png)


## 總計百分比
<a name="percent-of-total"></a>

**Percent of Total (總計百分比)** 函數計算特定儲存格在計算中所包含所有儲存格的總和中所佔的百分比。此百分比的計算方式為 `Cell1=Cell1/(sum of all cells), Cell2=Cell2/(sum of all cells),`，依此類推。

對表格列套用 **Percent of Total (總計百分比)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/percent-of-total.png)


## Rank
<a name="rank"></a>

**Rank (排名)** 函數計算儲存格值相較於計算中所包含的其他儲存格值的排名。排名一律顯示最高值等於 1，最低值等於計算中包含的儲存格計數。如果有兩個或更多儲存格是相等值，它們會獲得相同的排名，但在排名中各佔有一席之地。因此，下一個最高值的排名會下降，幅度為排名以上的儲存格數目，再減去 1。例如，若您將 5,3,3,4,3,2 這些值排名，則其排名會是 1,3,3,2,3,6。

例如，假設您有以下資料。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/rank.png)


對表格列套用 **Rank (排名)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/rank2.png)


## 百分位數
<a name="percentile"></a>

**Percentile (百分位數)** 函數計算包含於計算中的儲存格的值，其等於或低於特定儲存格的值的百分比。

此百分比的計算方式如下。

```
percentile rank(x) = 100 * B / N

Where:
   B = number of scores below x
   N = number of scores
```

對表格列套用 **Percentile (百分位數)** 函數，使用 **Table across (表格橫越)** 當成 **Calculate as (計算為)** 會得到以下結果。

![\[alt text not found\]](http://docs.aws.amazon.com/zh_tw/quick/latest/userguide/images/percentile.png)
