[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# IFNULL\n\nUse `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.\n\nSample usage\n------------\n\n`IFNULL(Discount, 0)`\n\nSyntax\n------\n\n`IFNULL( `\u003cvar translate=\"no\"\u003einput_expression\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003enull_result\u003c/var\u003e` )`\n\n### Parameters\n\n- **`input_expression`** -- The expression to evaluate. You can use any valid expression as the \u003cvar translate=\"no\"\u003einput_expression\u003c/var\u003e.\n\n- **`null_result`** -- The value to return if \u003cvar translate=\"no\"\u003einput_expression\u003c/var\u003e is null. If \u003cvar translate=\"no\"\u003einput_expression\u003c/var\u003e is not null, `IFNULL` returns the \u003cvar translate=\"no\"\u003einput_expression\u003c/var\u003e. You can use any valid expression as the \u003cvar translate=\"no\"\u003enull_result\u003c/var\u003e.\n\nExample\n-------\n\nCalculate 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.\n\nThe 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**:\n\n`IFNULL(Discount, 0)`\n\nThis formula can be read, \"If the **Discount** field is null, return 0, otherwise return **Discount**.\"\n\nYou can then calculate the average discount including orders with no discount:\n\n`AVG(Discount No Nulls)`"]]