13.4Writing text

Whether it is a title that changes with the filter, a label or a list of names, you will often need text in a report. These functions turn values into text and put texts together.

13.4.1FORMAT

In Excel
ExcelTEXT
Match

You need it when a date or a number must be written in a particular way, like “January 2024” rather than 1/15/2024.

FORMAT writes a value following a pattern.

FORMAT( <value>, <format_string> )

The first argument is the value to write, a date or a number. The second is the pattern, a text placed in quotes.

Month = FORMAT( Sales[Date], "mmmm yyyy" )
Power BI accepts this DAX forno, Measureyes, Calculated columnno, Calculated tableno, Virtual table
Month = FORMAT( Sales[Date], "mmmm yyyy" )
Table Sales
Sale IDDateMonth
V0011/15/2024January 2024
V0023/8/2024March 2024
V0035/20/2024May 2024
V0049/12/2024September 2024
V00511/25/2024November 2024
V0061/10/2025January 2025
V0072/18/2025February 2025
V0083/27/2025March 2025
V0095/6/2025May 2025
V0107/14/2025July 2025
V0119/30/2025September 2025
V01212/2/2025December 2025
Table: Sales (12 rows)

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

On the V001 row, the column shows “January 2024”.

Watch out!

FORMAT returns a text, even for a number. SUM and SUMX refuse a text, and a text is sorted in alphabetical order, April before January. So keep the original date or number to calculate and to sort.

Tip

To make a column of months written in full sort in calendar order, sort it by the column of month numbers, with the Sort by column button, as seen earlier.

FORMAT also writes a number following a pattern, with its thousands separators and its decimals.

Displayed Revenue = FORMAT( [Revenue], "#,0.00" )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“I want the revenue with a separator between the thousands and two digits after the decimal point.”

In a card with no filter, the measure shows “1,700,000.00”. This result is a text, even though it contains only digits. The pattern reads sign by sign.

  • 0 always writes a digit, even a zero.
  • # writes a digit only when it is useful, never a leading zero.
  • The comma separates the thousands.
  • The period introduces the decimals. As many 0 after it, as many decimals.

The pattern is always written with these signs, the comma for thousands and the period for decimals. Power BI then shows the result with the separators of the report’s language, here 1,700,000.00.

Other patterns, on the same measure.

  • "#,0" returns “1,700,000”, with no decimals.
  • "#,0.000" returns “1,700,000.000”, with three decimals.
  • "$#,0" returns “$1,700,000”. The symbol goes through as is.
  • "#,0,,.0 M" returns “1.7 M”. The two commas placed just before the period divide the number by a million.
  • "0.0 %" writes 0.267 as “26.7 %”. The % sign multiplies the number by 100.
Watch out!

Before the period, put a 0 rather than a #. With “#,#.00”, 0.5 is written “.50”, without its zero. With “#,0.00”, it is written “0.50”.

Tip

For a number on its own in a visual, set the format of the measure instead, in the Measure tools ribbon. The visual keeps a number, which sorts and adds up. FORMAT is mostly useful when the number goes into a text, like a title.

Title = "Revenue: " & FORMAT( [Revenue], "$#,0" )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table

In a card with no filter, the title shows “Revenue: $1,700,000”.

Practice

Each exercise is solved with the function you just discovered. Two exercises per function, a direct use and a combined use, from easiest to hardest, on data other than the course data. Pick the right formula out of five.

  1. Direct useCalculated columnDifficulty

    A bakery wants to group its tickets by month, written in full. Add the calculated column “Month” to the “Tickets” table, which writes the date like “March 2026”.

    Tickets
    TicketDate
    T-013/2/2026
    T-024/15/2026

    Which formula should you write for “Month”?

  2. Combined useMeasureDifficulty

    A library already has a “Loans” measure, the number of books lent. Write the “Title” measure, which writes this number with a separator between the thousands, without decimals, then a space and the text “books lent”. In a card, with 1250 loans, you read “1,250 books lent”.

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next 2, their animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.