FORMAT in DAX: format codes and dynamic formats

How the FORMAT function turns numbers and dates into text in DAX, named and custom number formats, thousands and millions scaling, date codes, locales, why FORMAT breaks charts and sorting, and dynamic format strings that keep a measure numeric.

Short answer: FORMAT ( value, format_string [, locale] ) returns text: FORMAT ( 12345.67, "#,0.0" ) is "12,345.7", FORMAT ( TODAY (), "mmm yyyy" ) is "Oct 2026". Use it for labels, titles and text columns. Do not use it to format a numeric measure for a chart or a total: the measure becomes text, charts cannot plot it, and sorting goes alphabetical. For that, set the measure's format, or a dynamic format string (Format: Dynamic), which changes how a number looks while it stays a number.

People reach for FORMAT to show "1.2M" instead of 1,234,567. It works on a card and breaks everywhere else. Knowing when to use the format string instead saves a lot of rework.

Which number formats are there?

Format stringResultNote
"General Number"1234567.891no formatting
"Standard"1,234,567.89thousands separator, 2 decimals
"Currency"$1,234,567.89the locale's currency
"#,0"1,234,568rounded, separators
"#,0.00"1,234,567.892 decimals
"0.0%" on 0.25625.6%one decimal
"#,0,"1,235one comma before the end divides by 1,000
"#,0.0,,"1.2two commas divide by 1,000,000
"#,0;(#,0);-" on -500(500)sections: positive; negative; zero
Number formats on 1234567.891

A custom format can have up to three sections separated by semicolons: positive, negative and zero values.

Which date codes are there?

CodeResultCodeResult
d29ddddThursday
dd29m10
dddThumm10
mmmOctmmmmOctober
q4yy26
yyyy2026hh:nn14:05
"yyyy-mm"2026-10"\Qq yyyy"Q4 2026
Date codes on 2026-10-29 14:05

In format strings, m after h means minutes; use nn for minutes to be safe. A backslash shows the next character literally.

When is FORMAT the right tool?

-- dynamic title on a visual (Format, Title, fx)
Title Revenue = "Revenue " & FORMAT ( MAX ( 'Date'[Date] ), "mmmm yyyy" )

-- label text that combines a number and words
Revenue Label = FORMAT ( [Revenue], "#,0" ) & " EUR (" & FORMAT ( [Margin %], "0.0%" ) & " margin)"

-- calculated column for a sortable month label: sort it by a number column
Month Label = FORMAT ( 'Date'[Date], "mmm yyyy" )

-- a fixed locale, independent of the user
Revenue DE = FORMAT ( [Revenue], "#,0.00", "de-DE" )

Text columns made with FORMAT sort alphabetically ("Apr" before "Jan"); set Sort by column to a number column (see date table).

How do dynamic format strings keep the number?

Select the measure, set Format to Dynamic, and write a DAX expression that returns the format string:

-- format string expression for [Revenue]
VAR V = ABS ( SELECTEDMEASURE ( ) )
RETURN
    SWITCH (
        TRUE (),
        V >= 1e9, "#,0.0,,,\B",
        V >= 1e6, "#,0.0,,\M",
        V >= 1e3, "#,0.0,\K",
        "#,0"
    )

The measure stays numeric: charts plot it, totals add up, sorting works, and the label shows 1.2M or 850.0K. Microsoft introduced dynamic format strings for exactly this problem with FORMAT; they also work in calculation groups.

What goes wrong?

  • FORMAT on chart measures. Text cannot be plotted or summed; use the format string.
  • FORMAT on BLANK. Returns an empty string, so rows with no data appear in tables; wrap in IF ( NOT ISBLANK ( [x] ), FORMAT ( ... ) ).
  • Locale surprises. Separators and currency follow the model culture or the locale argument; test with users in other countries.
  • m for minutes. Means month unless after h; use nn.
  • .NET format codes. DAX uses Visual Basic style codes, so some .NET codes give unexpected results.

Where can you check this?

Where do you start?

Find measures wrapped in FORMAT that sit in charts and move the formatting into a dynamic format string. CONCATENATEX builds text from lists, the other half of labels.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.