# GetExcludedCount - 圖表函數

GetExcludedCount() 用來尋找已識別欄位中的已排除相異值的數目。僅計入排除 (深灰色) 欄位。不會計入替代 (淺灰色) 和所選的排除 (有核取記號的深灰色) 值。

語法：

GetExcludedCount (field\_name)

傳回的資料類型： 字串

資訊備註

選項列中使用的顏色以及每個選取狀態的顏色都可以使用自訂佈景主題進行修改。如果您正在處理使用自訂佈景主題的應用程式，您可能會注意到您的選項顯示的顏色不同於此說明主題中描述的顏色。

引數

| 引數 | 描述 |
| --- | --- |
| field\_name | 包含待測量之資料範圍的欄位。 |

下表列出了與此函數相關的其他函數。

相關函數

| 函數 | 互動 |
| --- | --- |
| [GetStateCounts - 圖表函數](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FieldFunctions/getstatecounts.htm) | 使用 GetStateCounts()，您可以使用單一函數叫用合併下列計數的計算：<br><br><ul><li><p>所選包含值的計數。</p></li><li><p>可能值的計數。</p></li><li><p>替代值的計數。</p></li><li><p>排除值的計數，不包括替代值和所選的排除值。</p></li><li><p>所選排除值的計數。</p></li></ul> |
| [GetSelectedCount - 圖表函數](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FieldFunctions/getselectedcount.htm) | 傳回所選包含值的計數。 |
| [GetPossibleCount - 圖表函數](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FieldFunctions/getpossiblecount.htm) | 傳回可能值的計數。 |
| [GetAlternativeCount - 圖表函數](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FieldFunctions/getalternativecount.htm) | 傳回替代值的計數。 |

範例與結果：

以下範例使用載入至不同篩選窗格的兩個欄位，一個用於 First name 名字，另一個用於 Initials。

將以下的範例指令碼載入到應用程式中之後，建立三個篩選窗格：一個用於 First name，一個用於 Last name，一個用於 Initials。表格中的每個範例運算式可新增為 KPI 圖表。

範例與結果

| 範例 | 結果 |
| --- | --- |
| 假定未在 First name 中選取任何值。<br><br>`GetExcludedCount  (Initials)` | 結果為 0，因為沒有選項。 |
| 假定已在 First name 中選取 John。<br><br>`GetExcludedCount  (Initials)` | 結果為 5。Initials 中有 5 個深灰色的排除值。JA 值將是白色，因為它與 First name 中的選項 John 相關。 |
| 假定已選取 John 和 Peter。<br><br>`GetExcludedCount  (Initials)` | 結果為 3。在 Initials 中，John 與 1 個值相關，而 Peter 與 2 個值相關。 |
| 由於在 First name 中選取了 John 和 Peter，然後在 Last name 中選取了 Franc。<br><br>`GetExcludedCount ([First name])` | 結果為 3。First name 中有 3 個深灰色的排除值。GetExcludedCount() 只計入排除值。替代和所選排除值不會納入計數。 |
| 由於在 First name 中選取了 John 和 Peter，然後在 Last name 中選取了 Franc 和 Anderson。<br><br>`GetExcludedCount (Initials)` | 結果為 4。Initials 中有 4 個深灰色的排除值。其他兩個值 (JA 和 PF) 將會是白色，因為這與 First name 中的選項 John 和 Peter 相關聯。 |
| 由於在 First name 中選取了 John 和 Peter，然後在 Last name 中選取了 Franc 和 Anderson。<br><br>`GetExcludedCount ([Last name])` | 結果為 3。Last name 中有 3 個深灰色的排除值：Brown、Carr 和 Elliot。值 Devonshire 為淺灰色 (指示這是替代選項)，因此不會納入計數。 |

範例中使用的資料：

```
Names:
LOAD * inline [
First name|Last name|Initials|Has cellphone
John|Anderson|JA|Yes
Sue|Brown|SB|Yes
Mark|Carr|MC|No
Peter|Devonshire|PD|No
Jane|Elliot|JE|Yes
Peter|Franc|PF|Yes ] (delimiter is '|');
```

範例輸出

| First name | Initials | Has cellphone |
| --- | --- | --- |
| John | JA | Yes |
| Sue | SB | Yes |
| Mark | MC | No |
| Peter | PD | No |
| Jane | JE | Yes |
| Peter | PF | Yes |