FORMAT Function (DAX)

Converts a value to text according to the specified format.

This article describes a function in Data Analysis Expressions (DAX), a formula expression language used to define calculations in PowerPivot in Excel. Many DAX functions have the same name and similar behavior as Excel functions; however, DAX functions can only be used in DAX formulas.

In this article

Syntax

Parameters

Return Value

Remarks

Syntax

FORMAT(<value>, <format_string>)

Top of Page

Parameters

Term

Definition

value

A value or expression that evaluates to a single value.

format_string

A string with the formatting template.

Top of Page

Return Value

A string containing value formatted as defined by format_string.

Important   
If value is BLANK() the function returns an empty string.

If format_string is BLANK(), the value is formatted with a "General Number" or "General Date" format (according to value type).

Top of Page

Remarks

For information on how to use the format_string parameter, see the appropriate topic listed below:

To Format

Follow these 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.

Caution    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.

This DAX function is not supported for use in DirectQuery mode. For more information about limitations in DirectQuery models.

Top of Page

Applies To: Excel 2013



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language