

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

# countIf
<a name="countIf-function"></a>

根據條件陳述式，`countIf` 函數會計算維度或量值中的值數量 (依照選擇的一個或多個維度分組)。

## 語法
<a name="countIf-function-syntax"></a>

```
countIf(dimension or measure, condition)
```

## 引數
<a name="countIf-function-arguments"></a>

 *dimension or measure*   
引數必須是量值或維度。結果會省略空值。常值無作用。引數必須是欄位。

 *condition*   
單一陳述式中的一個或多個條件。

## 傳回類型
<a name="countIf-function-return-type"></a>

Integer

## 範例
<a name="countIf-function-example"></a>

下列函數會傳回符合條件的銷售交易 (`Revenue`) 統計，包括任何重複項。

```
countIf (
    Revenue,
    # Conditions
        CalendarDay >= ${BasePeriodStartDate} AND 
        CalendarDay <= ${BasePeriodEndDate} AND 
        SourcingType <> 'Indirect'
)
```