DAX FORMAT function
Converts a value to text, using a format you choose.
FORMAT turns numbers and dates into text with a pattern: thousands separators, percentages, month names. Use it in labels and titles, not for numbers you still need to calculate with.
Syntax
FORMAT(<value>, <format_string>[, <locale_name>])| Argument | Required | Description |
|---|---|---|
| value | Required | The number or date to format. |
| format_string | Required | The pattern, like "#,##0", "0.0%" or "mmm yyyy". |
| locale_name | Optional | A locale such as "en-US" for separators and month names. |
Returns: A text.
Examples
Calculated on the free practice data (table financials), with [Total Sales] = SUM(financials[Sales]) and [Total Profit] = SUM(financials[Profit]).
1. A readable margin label
Margin Label = FORMAT(DIVIDE([Total Profit], [Total Sales]), "0.0%")| Segment | Margin Label |
|---|---|
| Channel Partners | 73.1% |
| Enterprise | -3.1% |
| Government | 21.7% |
| Midmarket | 27.7% |
| Small Business | 9.8% |
| Total | 14.2% |
Text, ready for a title or a card subtitle.
Good to know
- The result is text: it sorts alphabetically and can't be summed. To change how a number looks in visuals, set the measure's format instead.
Related functions
Official reference: FORMAT function on Microsoft Learn