COALESCE
Applies to:
Calculated column
Calculated table
Measure
Visual calculation
Returns the first expression that does not evaluate to BLANK. If all expressions evaluate to BLANK, BLANK is returned.
Syntax
COALESCE(<expression>, <expression>[, <expression>]…)
Parameters
Term | Definition |
---|---|
expression | Any DAX expression that returns a scalar expression. |
Return value
A scalar value coming from one of the expressions or BLANK if all expressions evaluate to BLANK.
Remarks
Input expressions may be of different data types.
Example 1
The following DAX query:
EVALUATE { COALESCE(BLANK(), 10, DATE(2008, 3, 3)) }
Returns 10
, which is the first expression that does not evaluate to BLANK.
Example 2
The following DAX expression:
= COALESCE(SUM(FactInternetSales[SalesAmount]), 0)
Returns the sum of all values in the SalesAmount column in the FactInternetSales table, or 0
.
This can be used to convert BLANK values of total sales to 0
.
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho