Converts a value to text in the specified number format.
A number, or a formula that evaluates to a numeric value.
A number format that you specify.
A string containing Value formatted as defined by Format string.
The result is always a string, even when the value is blank.
For information on how to use the Format string parameter:
- Numbers: Use predefined numeric formats or create custom numeric formats.
- Dates and times: Use predefined date/time formats or create user-defined date/time formats.
The format strings supported as an argument to the DAX FORMAT function are based on the format strings used by Visual Basic (OLE Automation), not on the format strings used by the .NET Framework. Therefore, you might get unexpected results or an error if the argument does not match any defined format strings. For example, “p” as an abbreviation for “Percent” is not supported. Strings that you provide as an argument to the FORMAT function that are not included in the list of predefined format strings are handled as part of a custom format string, or as a string literal.
In order to make sure a literal is not interpreted as a format string, embed the literal between double quotes as in the examples.
FORMAT ( 0.742, "Percent" ) -- Returns 74.20% FORMAT ( 1234.567, "$#,0.00" ) -- Returns $1,234.57 FORMAT ( 1234.567, """US$"" #,0.00" ) -- Returns US$ 1,234.57 FORMAT ( DATE ( 2019, 3, 28 ), "yyyy-mm-dd" ) -- Returns 2019-03-28 FORMAT ( DATE ( 2019, 3, 28 ), "m/d/yy" ) -- Returns 3/28/19
Contributors: Alberto Ferrari, Marco Russo
MSDN documentation: https://docs.microsoft.com/en-us/dax/format-function-dax