count_distinct

count_distinct(expression)

説明

count_distinct 関数は、グループ内で異なる値を持つ行の数を返します。多くの場合、match とともに使用して、データ内の特定のグループのカウントを取得します。

パラメータのデータ型

STRING

戻り値の型

NUMBER

コードサンプル

時間の経過に伴う、ユーザーの個別のログイン成功数を返します。

  metadata.event_type = "USER_LOGIN"
  $security_result = security_result.action
  $security_result = "ALLOW"
  $date = timestamp.get_date(metadata.event_timestamp.seconds, "America/Los_Angeles")
  match:
      $security_result, $date
  outcome:
      $event_count = count_distinct(metadata.id)