Text.Format

This function generates formatted text by plugging in arguments from a list or record into a specified format string. You can also specify an optional culture, such as "en-US".

Syntax

Text.Format(formatString as text, arguments as any, optional culture as nullable text) as text

About

This function generates formatted text by plugging in arguments from a list or record into a specified format string. You can also specify an optional culture, such as "en-US".

Explanation

Example 1 To arrange a list of numbers in a particular format, utilize Power Query MText. To do so, apply the following code snippet: Format("#{0}, #{1}, and #{2}.", {17, 7, 22}). This command will produce the output "17, 7, and 22." Example 2 For the task of formatting data types from a record in accordance with United States English conventions, implement Power Query MText. Use the code below to achieve this: Text.Format("The time for the #[distance] km run held in #[city] on #[date] was #[duration].", [ city = "Seattle", date = #date(2015, 3, 10), duration = #duration(0, 0, 54, 40), distance = 10 ], "en-US"). Upon execution, this command will yield the output "The time for the 10 km run held in Seattle on 3/10/2015 was 00:54:40."