Text Function (Convert Numbers / DateTime to Text) | Power Fx | Copilot Studio - Power Apps
Power Apps
Dec 22, 2023 4:30 PM

Text Function (Convert Numbers / DateTime to Text) | Power Fx | Copilot Studio - Power Apps

by HubSite 365 about Joe Unwin [MVP] (FlowJoe)

Power Platform Lead @ Hitachi | FTRSA, MVP & MCT

Citizen DeveloperPower AppsMicrosoft Copilot StudioLearning Selection

Learn how to use the Text function's capabilities in Power Fx to convert Numbers or Dates and Times to Text. This demo uses Power Apps, but it's the same wherev

In Power Fx, the language used for Microsoft Power Apps, there's a versatile function called Text that allows you to convert numbers and DateTime values into a text format. This function is particularly useful for formatting data in a way that's more readable or aligns with specific display requirements.

Here's a basic overview of how the Text function works:

  • Syntax: Text(value, formatString)
  • Value: This is the number or DateTime value you want to convert to text.
  • FormatString: This optional parameter defines the format in which the value should be converted. If omitted, a default format is used.

For numbers, you can use format strings like "0.00" to always show two decimal places, or "#,###" to include thousand separators.

When dealing with DateTime values, you have a variety of format options like "dd/MM/yyyy" for day-month-year format or "dddd, MMMM dd" for a more verbose date representation.

Here's an example:

    Text(1234.567, "0.00")   // Returns "1234.57"
    Text(Now(), "dddd, MMMM dd yyyy") // Returns current day in a format like "Tuesday, December 17 2023"

This function is incredibly useful for ensuring data is presented in a user-friendly way, making Power Fx a powerful tool for customizing how information is displayed in your Power Apps.

Summary: Power Fx Text Function

The Text function in Power Fx is a key tool for converting numbers and DateTime values into a formatted text string. It's essential for customizing the display of data in Power Apps, offering various format options for different types of data.