Notification

This article is about Looker Studio. For Looker documentation, visit https://cloud.google.com/looker/docs/intro.

ขณะนี้หน้าที่คุณขอยังไม่พร้อมให้บริการในภาษาของคุณ คุณสามารถเลือกภาษาอื่นได้ที่ด้านล่างของหน้าหรือแปลหน้าเว็บใดๆ ให้อยู่ในภาษาที่คุณต้องการได้ทันที โดยใช้คุณลักษณะการแปลภาษาในตัวของ Google Chrome

COUNT_DISTINCT

The COUNT_DISTINCT function counts the number of unique items in a field.

Syntax

COUNT_DISTINCT(X)

Parameters

  • X - a field or expression that contains the items to be counted.

How the COUNT_DISTINCT function works

The COUNT_DISTINCT function takes 1 parameter, which can be the name of a metric, dimension, or expression of any type. COUNT_DISTINCT returns the total number of unique items in that field or expression.

To count all items, including duplicates, use COUNT.

There are 2 other ways to apply this function:

Examples

Example formula Output
COUNT_DISTINCT(user_id) 22,854,921
COUNT_DISTINCT(order_id) 497,091,812

Limits of COUNT_DISTINCT

You can't apply this function to a pre-aggregated field (Aggregation type of Auto), or to an expression which is the result of another aggregation function. For example, a formula such as COUNT_DISTINCT(Sessions) in a Google Analytics data source will produce an error.

To avoid possibly incurring higher query costs when using BigQuery data sources, consider using APPROX_COUNT_DISTINCT.

ข้อมูลนี้มีประโยชน์ไหม

เราจะปรับปรุงได้อย่างไร
true
What's new in Looker Studio?

Learn about new features and recent changes. Looker Studio release notes live on Google Cloud.

Search
Clear search
Close search
Main menu
5712414158711404467
true
ค้นหาศูนย์ช่วยเหลือ
true
true
true
true
true
102097
false
false