Dax Function: FORMAT
Category: Text Functions
The FORMAT function in Power BI is a DAX text function used to convert numbers or dates into formatted text based on specified formatting strings. This function is versatile, allowing developers to display data in a wide range of styles and formats suitable for reports and dashboards.
Purpose
The FORMAT function is designed to:
- Convert numerical values or dates into strings.
- Apply custom formatting styles such as currency, percentages, or date/time formats.
- Enhance the readability of data by making it visually appealing and aligned with localization requirements.
Type of Calculations
- Transforms numbers and dates into user-defined string formats.
- Localizes formats based on cultural preferences or custom patterns.
- Does not perform arithmetic calculations; instead, it focuses on formatting and representation.
Practical Use Cases
- Displaying sales figures as currency values with specific symbols.
- Formatting dates to match regional preferences (e.g.,
MM/DD/YYYYorDD-MM-YYYY). - Showing percentages or ratios in a visually intuitive way.
- Preparing labels or annotations in visuals with formatted values.
FORMAT(<value>, <format_string>)</format_string></value>
| Parameter | Type | Description |
|---|---|---|
| value | Scalar | The numeric or date/time value to format. |
| format_string | Text | A format string defining how the value should appear. For example, "#,##0.00" or "dd-mmm-yyyy". |
How Does FORMAT Dax Function Works
- The function takes a numeric or date input and a format string.
- The input is converted into a text representation based on the specified format.
- For numeric values, it handles symbols (e.g.,
$,%) and number patterns. For dates, it manages day, month, year, and time components.
What Does It Return?
The FORMAT function returns a text string representing the formatted version of the input value.
When Should We Use It?
- To improve data presentation in reports and dashboards.
- When exporting data to systems requiring specific formats.
- To create dynamic text-based visualizations or tooltips.
Examples
Basic Usage – Formatting Numbers:
FORMAT(12345.678, "#,##0.00")
Result: "12,345.68"
Formatting Dates:
FORMAT(DATE(2023, 12, 25), "MMMM DD, YYYY")
Result: "December 25, 2023"
Currency Formatting:
FORMAT(1000, "$#,##0")
Result: "$1,000"
Percentage Formatting:
FORMAT(0.85, "0.00%")
Result: "85.00%"
Column Usage:
SalesFormatted = FORMAT(Sales[Amount], "€#,##0.00")
Creates a new column with sales values displayed as currency in Euros.
Advanced Usage – Combining with Other Functions:
"Revenue on " & FORMAT(TODAY(), "dd-mm-yyyy") & ": " & FORMAT(Sales[Amount], "$#,##0.00")
Result: "Revenue on 10-02-2025: $12,345.00"
Tips and Tricks
- Use predefined format strings (
"Currency","General Number","Short Date") for simplicity. - Avoid excessive use in calculated columns on large datasets to reduce memory usage.
- Combine FORMAT with other DAX functions like CONCATENATE for dynamic text creation.
- Be aware that the output is text, not numeric, so further calculations on the result are not possible.
Performance Impact of FORMAT DAX Function:
- Avoid using FORMAT on large datasets in calculated columns due to text storage overhead.
- For faster performance, use native formatting options in visuals when possible.
Related Functions You Might Need
- FIXED: Formats numbers as text with a fixed number of decimals.
- TEXT: Similar to FORMAT but more commonly used in Excel.
- CONCATENATE: Combines text strings, often used with FORMAT.
- VALUE: Converts text back into a numeric value if needed.
Want to Learn More?
For more information, check out the official Microsoft documentation for FORMAT You can also experiment with this function in your Power BI reports to explore its capabilities.
Unlock the full capabilities of Power BI and elevate your data insights with our specialized consulting services. Whether you need guidance on advanced DAX functions like those highlighted here, support in designing interactive dashboards, or expertise in optimizing data models for enhanced performance, our experienced Power BI consultants are equipped to deliver customized solutions for your business. Explore our Power BI Consulting Services page to discover how we can help your organization make smarter, data-driven decisions.
The FORMAT function converts numbers and dates into formatted text using custom patterns.
Yes, FORMAT can apply localized formats based on the format string and regional settings.
No, the output is always a text string.
Examples include "Currency", "General Number", "Short Date", and "Percent".
No, since the result is text, you cannot use it for numerical calculations directly.