Pre-Defined Numeric Formats for the FORMAT Function (DAX)

The following table identifies the predefined numeric format names. These may be used by name as the style argument for the Format function:

Format specification

Description

"General Number", "G", or "g"

Displays number with no thousand separators.

"Currency", "C", or "c"

Displays number with thousand separators, if appropriate; displays two digits to the right of the decimal separator. Output is based on system locale settings.

"Fixed", "F", or "f"

Displays at least one digit to the left and two digits to the right of the decimal separator.

"Standard", "N", or "n"

Displays number with thousand separators, at least one digit to the left and two digits to the right of the decimal separator.

"Percent"

Displays number multiplied by 100 with a percent sign (%) appended immediately to the right; always displays two digits to the right of the decimal separator.

"P", or "p"

Displays number with thousandths separator multiplied by 100 with a percent sign (%) appended to the right and separated by a single space; always displays two digits to the right of the decimal separator.

"Scientific"

Uses standard scientific notation, providing two significant digits.

"E", or "e"

Uses standard scientific notation, providing six significant digits.

"D", or "d"

Displays number as a string that contains the value of the number in Decimal (base 10) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

"X", or "x"

Displays number as a string that contains the value of the number in Hexadecimal (base 16) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

"Yes/No"

Displays No if number is 0; otherwise, displays Yes.

"True/False"

Displays False if number is 0; otherwise, displays True.

"On/Off"

Displays Off if number is 0; otherwise, displays On.

Remarks

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); but, if you change the casing to "d" you get the date in the short format. Also, unexpected results or an error might occur if the intended formatting does not match the case of any defined format string.

Example

The following samples show the usage of different predefined formatting strings to format a numeric value.

FORMAT( 12345.67, "G")
FORMAT( 12345.67, "C")
FORMAT( 12345.67, "F")
FORMAT( 12345.67, "N")
FORMAT( 12345.67, "P")
FORMAT( 12345.67, "Scientific")

The above expressions return the following results:

12345.67 "G" displays the number with no formatting.

$12,345.67 "C" displays the number with your currency locale formatting. The sample here shows the default United States currency formatting.

12345.67 "F" displays at least one digit to the left of the decimal separator and two digits to the right of the decimal separator.

12,345.67 "N" displays at least one digit to the left of the decimal separator and two digits to the right of the decimal separator, and includes thousand separators. The sample here shows the default United States number formatting.

1,234,567.00 % "P" displays the number as a percentage (multiplied by 100) with formatting and the percent sign at the right of the number separated by a single space.

1.23E+04 "Scientific" displays the number in scientific notation with two decimal digits.

See Also

Other Resources

FORMAT Function (DAX)

Pre-Defined Date and Time formats for the FORMAT Function (DAX)

Custom Numeric Formats for the FORMAT Function (DAX)