

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

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

`firstValue` 函數計算依指定屬性分割和排序的彙總計量或維度的第一個值。

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

需使用括弧。若要了解哪些參數是選用的，請參閱以下描述。

```
firstValue
	(
	     aggregated measure or dimension, 
	     [ sort_attribute ASC_or_DESC, ... ],
	     [ partition_by_attribute, ... ] 
	)
```

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

*aggregated measure or dimension*   
您要查看第一個值的彙總量值或維度。

*sort attribute*   
您要排序資料依據的一或多個彙總欄位，可以是度量和維度或兩者，以逗號分隔。您可以指定遞增 (**ASC**) 或遞減 (**DESC**) 排序順序。  
如果有不只一個字，則清單中的每個欄位會括在 \$1\$1 (大括號) 中。整個清單會以 [ ] (方括弧) 括住。

*partition by attribute*  
(選用) 您要分割依據的一或多個量值或者維度，以逗號分隔。  
如果有不只一個字，則清單中的每個欄位會括在 \$1\$1 (大括號) 中。整個清單會以 [ ] (方括弧) 括住。

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

下列範例計算依 `Flight Date` 排序、依遞增排序之 `Flight Date` 和 `Origin Airport` 分割的第一個 `Destination Airport`。

```
firstValue(
    {Destination Airport}
    [{Flight Date} ASC],
    [
        {Origin Airport},
        {Flight Date}
    ]
)
```