PowerApps, a powerful low-code development platform, allows users to create custom applications without extensive coding knowledge. In this blog post we will learn how to:
- Format text in PowerApps
- Format text to date in PowerApps
- Format Number in PowerApps
- PowerApps format number as percentage
- Format text to Currency in PowerApps
- Format text to Special format in PowerApps
Format text in PowerApps
PowerApps provides the Text function that allow you to manipulate and format text strings into different format
Syntax of PowerApps text function:
TEXT(Value you want to format, "Format code you want to apply")
Format Number in PowerApps
In the following examples we will convert PowerApps text input number format
Example: You want to format the number 123.23232 to display only two decimal digits and be 123.23 to do that you can use the Text function.
Solution :
Text( 123.23232,"#.##")
Result:
123.23
The formula “Text(123.23232, “#.##”)” in PowerApps converts the number 123.23232 into a formatted text string with a specific decimal format.
Breaking down the formula:
- “Text” is a function in PowerApps used to convert a value to a formatted text string.
- “123.23232” is the number you want to format.
- “#.##” is the format specifier used to represent the number with two decimal places, with any trailing zeros removed.
When the formula is evaluated, it will return the text string “123.23”, which represents the number 123.23232 formatted with two decimal places. The format specifier “#.##” rounds the number to two decimal places and removes any trailing zeros after the decimal point.
Also you can format the value that coming from your data source as following
The old number is the default result
The New number is the result after formating
powerapps format number thousand separator
When formatting numbers in PowerApps to include a thousand separator (comma or period), you can use the Text function in combination with the appropriate format specifier. Here are a few examples:
- Format a number with a comma as the thousand separator:
Text(1000, "#,##0")
Output: 1.000
Text(10000, "#,##0")
Output: 10.000
- Format a number with a comma as the thousand separator and two decimal places:
Text(1000, "#,##0.00")
Output: 1,000.00
Text(10000, "#,##0.00")
Output: 10,000.00
powerApps format number as percentage
To format a number as a percentage in PowerApps, you can use the Text function and apply Format Percent .
Example:
Assuming you have a numeric value in a variable called “MyNumber” that you want to display as a percentage
Solution:
Text(MyNumber, "0.00%")
“0.00%” format is used to display the number as a percentage with two decimal places.
Remember to replace “MyNumber” with the name of your actual variable or data source field that contains the numeric value you want to format.
Text(2.565646,"00.0%") The result will be 02.6%
Text(2.565646,"0.00%") The result will be 2.57%
apply currency formatting in Power APps
To format number as currency in PowerApps, you can use the Text function in conjunction with the FormatCurrency that you want.
Example:
Text(24646, "$#,##0.00")
This formula uses the Text function to convert the numeric value into a formatted text string,
The formula “Text(24646, “$#,##0.00”)” in PowerApps converts the number 24646 into a formatted text string representing a currency value.
Breaking down the formula:
- “Text” is a function in PowerApps used to convert a value to a formatted text string.
- “24646” is the number you want to format as currency.
- “$#,##0.00” is the format specifier used to represent the number as currency with a dollar sign, comma as a thousand separator, and two decimal places.
When the formula is evaluated, it will return the text string “$24,646.00”, which represents the number 24646 formatted as a currency value with two decimal places and the dollar sign symbol.
Format text to date in PowerApps
In these examples we will learn how PowerApps format date?
To format text in PowerApps to date, you can use the Text function along with the appropriate format specifier.
Example:
In this example we will format the today date to this format “dd/mm/yy” as shown in the bellow image.
Example : Format text to date in PowerApps and display the date in the format “mmmm dd, yyyy”:
Text(Today(), "mmmm dd, yyyy")
Output: "June 01, 2023"
Example: Format text to date in PowerApps and display the date in the format “dd/mmm/yyyy”:
Text(Today(), "dd/mmm/yyyy")
Output: "01/Jun/2023"
Example: Format text to date in PowerApps and display the date in the format “mm/dd/yy”:
Text(MyDate, "MM/dd/yy")
Output: "06/01/23"
Example: Format text to date in PowerApps and display the date in the format “mm/dddd/yy”:
Text(Today(), "mm/dddd/yy")
Output: "06/Thursday/2023"
Example: Format text to date in PowerApps and display the date in the format “mmmm-dddd-yyyy”:
Text(Today(), "mmmm-dddd-yyyy")
Output: "June/Thursday/2023"
PowerApps format Phone number
Text(1234567898,"(###) ###-####")
Output: (123) 456-7889
Conclusion
Formatting text in PowerApps plays a crucial role in creating visually appealing and user-friendly applications and its easy to use the Text function to format text and numbers to different format
See Also
- Alternate Row Color In Gallery PowerApps: Simplest Way
- Check If PowerApps Contains Substring
- PowerApps If Statement And Nested If With Example
- Environment Variable In Power Platform With Examples
- Model Driven App With SharePoint Data Source
Join us
- Subscribe to Power Platform Geeks.