Notification

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

Trang bạn đã yêu cầu hiện không có sẵn bằng ngôn ngữ của bạn. Bạn có thể chọn ngôn ngữ khác ở cuối trang hoặc dịch nhanh mọi trang web sang ngôn ngữ mà bạn chọn bằng cách sử dụng tính năng dịch được tích hợp sẵn trong Google Chrome.

IFNULL

Returns a result if the input is null, otherwise, returns the input.

Use IFNULL to replace NULL values in your data with a more suitable or meaningful value. This can be helpful when you want to avoid displaying NULLs in your charts or when you need a specific value for further calculations.

Sample usage

IFNULL(Discount, 0)

Syntax

IFNULL(input_expression, null_result)

Parameters

input_expression

The expression to evaluate. You can use any valid expression as the input_expression.

null_result

The result to return if input_expression is null.  If input_expression is not null, IFNULL returns the input_expression. You can use any valid expression as the input_expression.

Example

Calculate the average discount given to your customers, including orders that received no discount. However, your application sometimes represents "no discount" as null rather than 0.

The formula AVG(Discount) won't include null discounts. You'll need to convert those nulls to zero. To do this, create a new field called, for example, Discount No Nulls:

IFNULL(Discount, 0)

This formula can be read, "If the Discount field is null, return 0, otherwise return Discount."

You can then calculate the average discount including orders with no discount:

AVG(Discount No Nulls)

Thông tin này có hữu ích không?

Chúng tôi có thể cải thiện trang này bằng cách nào?
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
10856912072111998776
true
Tìm kiếm trong Trung tâm trợ giúp
true
true
true
true
true
102097
false
false