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
| Excel | TEXT |
|---|---|
| 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.
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" )| Sale ID | Date | Month |
|---|---|---|
| V001 | 1/15/2024 | January 2024 |
| V002 | 3/8/2024 | March 2024 |
| V003 | 5/20/2024 | May 2024 |
| V004 | 9/12/2024 | September 2024 |
| V005 | 11/25/2024 | November 2024 |
| V006 | 1/10/2025 | January 2025 |
| V007 | 2/18/2025 | February 2025 |
| V008 | 3/27/2025 | March 2025 |
| V009 | 5/6/2025 | May 2025 |
| V010 | 7/14/2025 | July 2025 |
| V011 | 9/30/2025 | September 2025 |
| V012 | 12/2/2025 | December 2025 |
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”.
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.
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.
“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.
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”.
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.
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.
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 Ticket Date T-01 3/2/2026 T-02 4/15/2026 Which formula should you write for “Month”?
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.