FORMAT Function (DAX)
Converts a value to text according to the specified format.
FORMAT(<value>, <format_string>)
Parameters
Term |
Definition |
value |
A value or expression that evaluates to a single value. |
format_string |
A string with the formatting template. |
Return Value
A string containing value formatted as defined by format_string.
Remarks
For information on how to use the format_string parameter, see the appropriate topic listed below:
To Format |
Follow this instructions |
Numbers |
Use predefined numeric formats or create user-defined numeric formats. |
Dates and times |
Use predefined date/time formats or create user-defined date/time formats. |
All predefined formatting strings use the current user locale when formatting the result.
Warning
Formatting strings are case sensitive. Different formatting can be obtained by using a different case. For example, when formatting a date value with the string "D" you get the date in the long format (according to your current locale). However, if you change the casing to "d" you get the date in the short format. Also, you might get unexpected results or an error if the intended formatting does not match the case of any defined format string.
See Also
Other Resources
Pre-Defined Numeric Formats for the FORMAT Function (DAX)
Custom Numeric Formats for the FORMAT Function (DAX)
Pre-Defined Date and Time formats for the FORMAT Function (DAX)