ISERRORISERROR

检查值是否错误,并返回 TRUE 或 FALSE。Checks whether a value is an error, and returns TRUE or FALSE.

语法Syntax

ISERROR(<value>)  

parametersParameters

术语Term 定义Definition
value 要测试的值。The value you want to test.

返回值Return value

如果值错误,则布尔值为 TRUE;反之为 FALSE。A Boolean value of TRUE if the value is an error; otherwise FALSE.

示例Example

以下示例计算 Internet 总销售额与经销商总销售额的比率。The following example calculates the ratio of total Internet sales to total reseller sales. ISERROR 函数用于检查除数为零等错误。The ISERROR function is used to check for errors, such as division by zero. 如果出现错误,则返回空白,反之返回比率。If there is an error a blank is returned, otherwise the ratio is returned.

= IF( ISERROR(  
       SUM('ResellerSales_USD'[SalesAmount_USD])  
       /SUM('InternetSales_USD'[SalesAmount_USD])  
             )  
    , BLANK()  
    , SUM('ResellerSales_USD'[SalesAmount_USD])  
      /SUM('InternetSales_USD'[SalesAmount_USD])  
    )  

另请参阅See also

信息函数 (DAX)Information functions (DAX)
IFERROR 函数 (DAX)IFERROR function (DAX)
IF 函数 (DAX)IF function (DAX)