[[["わかりやすい","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-03-04 UTC。"],[],[],null,["# Conditional formatting using value_format\n\nIt's common for users to want to interact with short numbers. For example, they prefer $2.5M to a long string like $2,523,093.25. You can build short-number displays by creating multiple defined LookML measures, such as one to display as-is, one divided by 1,000, or one with limited decimal places, and so on.\n\n\nLookML can achieve these displays automatically with some more advanced [`value_format`](/looker/docs/reference/param-field-value-format) syntax.\n\nSyntax\n------\n\n\nUse this pattern to set value formats with conditions: \n\n```\n[if_condition]format; [if_condition]format; else_format\n```\n| Note that Looker only supports up to two `if_condition` conditions. If you add more than two conditions, any conditions after the first two will be ignored.\n\n\nSince the value of the `value_format` parameter is already enclosed in double quotes in LookML, any nested double quotes will need to be escaped using the backslash `\\` character.\n\nExample with large numbers\n--------------------------\n\n\nTo make numbers such as 12.23M or 2.33K, you can use the following code: \n\n```\n [\u003e=1000000]0.00,,\\\"M\\\";[\u003e=1000]0.00,\\\"K\\\";\n```\n\n\nOr with no decimal places: \n\n```\n [\u003e=1000000]0,,\\\"M\\\";[\u003e=1000]0,\\\"K\\\";0\n```\n\n\nHere is the measure in LookML using this format, with dollar signs added: \n\n```\n measure: global_amount {\n type: sum\n sql: ${TABLE}.total\n value_format: \"[\u003e=1000000]$0.00,,\\\"M\\\";[\u003e=1000]$0.00,\\\"K\\\";$0.00\"\n drill_fields: invoices*\n }\n```\n\nExample with large negative numbers\n-----------------------------------\n\n\nYou can use similar syntax with negative numbers. To make numbers such as -12.23M or -2.33K, you can use the following code: \n\n```\n [\u003c=-1000000]0.00,,\\\"M\\\";[\u003c=-1000]0.00,\\\"K\\\";\n```\n\n\nOr with no decimal places: \n\n```\n [\u003c=-1000000]0,,\\\"M\\\";[\u003c=-1000]0,\\\"K\\\";0\n```\n\n\nHere is the measure in LookML using this format, with dollar signs added: \n\n```\n measure: global_amount_negative {\n type: sum\n sql: ${TABLE}.total\n value_format: \"[\u003c=-1000000]$0.00,,\\\"M\\\";[\u003c=-1000]$0.00,\\\"K\\\";$0.00\"\n drill_fields: invoices*\n }\n```"]]