count_distinct
count_distinct 함수는 그룹 내에서 고유한 값을 갖는 행의 수를 반환합니다. 데이터에서 특정 그룹의 개수를 가져오기 위해 match와 함께 자주 사용됩니다.
| 구문 | 매개변수 데이터 유형 | 반환 유형 |
|---|---|---|
count_distinct(expression) |
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)