PowerApps Value Function – How to use

In this PowerApps Tutorial, We will discuss what is value function in PowerApps, An introduction to the Powerapps Value function and What is the syntax of the PowerApps Value Function. Also, we will see how to convert text to number using PowerApps Value Function.

Also, by taking some simple examples, We will see how we can use this Value Function in Powerapps using different types of formulas.

Also, We will discuss these below things that are related to Powerapps Value function as:

  • How to convert text to number in Powerapps
  • How to convert Date to Text in PowerApps
  • Powerapps convert month number to text or Extract month name from a date field in Powerapps

Value Function in PowerApps

PowerApps Value Function is a type of function that helps to convert a string of text to a number value. You can use this function at the time of doing any calculations on numbers.

You may like PowerApps AddColumns Function with Examples.

Introduction to PowerApps Value Function

You can specify the value with a language tag that is returned by the Language function. The string of text is interpreted in the language of the current user. Like different languages interpret with “,” and “.” differently.

Below are some points that you need to remember while working with the Powerapps Value Function:

  • If the string is in scientific notation with “15*10^2“, then the value will express as “15e2“.
  • If the string contains a percentage symbol (%) at the end, then it specifies as a percentage. The specific number will be divided by 100 before it is returned.
  • You need to keep in mind that, Percentages and Currency symbols can not be mixed.
  • If a string contains a Currency symbol ($) for the current language, then it will ignore the currency symbol. But for other languages, the currency symbol is not ignored.
  • In case the number is not in a proper format, then a blank value will return.
  • Similarly, you can use the DateValue, TimeValue, or DateTimeValue functions to convert the Date and Time values.

PowerApps Value Function Syntax

The syntax of PowerApps Value Function is:

Value( String [, LanguageTag ] )

Where,

  • String = This is Required. Provide a text or string to convert it to a numeric value.
  • LanguageTag = This is optional. It helps to parse the string. If you will not specify, then it will use the language of the current user. Always the Language function returns with “en-US“.

Powerapps Value Function Examples

Below table represents some Value function examples with different formulas and and its results.

FormulaDescriptionResult
Value( “789,123” )Here, the default language of “en-US” will be used, which uses a comma as a thousands separator.789123
Value( “789.123” )Here, the default language of “en-US” will be used, which uses a period as the decimal separator.789.123
Value( “789.123”, “es-ES” )“es-ES” is the language tag for Spanish in Spain. In Spain, a period is a thousand separator.789123
Value( “54e3” )This specifies the scientific notation for 54*10^354000
Value( “78.19%” )Here the value represents a percentage symbol at the end of the string, so it is a percentage.0.7819
Value( “$ 78.19” )Here, the currency symbol is ignored for the current language.78.19
Value( “789,123”, “es-ES” )“es-ES” is the language tag for Spanish in Spain. In Spain, a Comma specifies with a Decimal separator.789.123

Powerapps convert text input to a number

Here, we will see how we can convert the text input to a numerical value or number in PowerApps. For this thing, we will use Powerapps Value Function.

By taking a simple scenario, I will explain to you that how you can convert PowerApps text to number value. Follow these below steps that you need to do:

Step-1:

At first, Create an Excel spreadsheet and add some columns over there. The below screenshot represents my Excel sheet named “BookPurchaseDetails“. This excel has three columns as:

  • BookName: This is a general or text data type where the user will specify the name of the book.
  • Location: This is also a general or text data type where the user will enter the location.
  • BookPrice: This is a Number data type with Currency format as shown below: (Select the BookPrice column -> Go to Home tab -> Select Number Data type -> Choose any Currency symbol ($) like US, UK, China etc)

Do not add any record in the Excel sheet. Because, we will insert the record by using the PowerApps Value function.

Powerapps convert text input to a number
PowerApps Value Function

Step-2:

  • Next, select the columns from Excel and format it as Table (Go to Home tab -> Format as Table -> Select any table that you want)
  • Provide the Table name (Select the Excel -> Go to Design tab -> Enter the name under the Table Name field) as:
Powerapps convert text input to number
PowerApps Value Function

Step-3:

Now, you need to upload the Excel spreadsheet in your OneDrive. Open your OneDrive account and upload this Excel (BookPurchaseDetails) as like the below screenshot.

convert text to number in powerapps
PowerApps Value Function syntax

Step-4:

Now it’s time to create Powerapps canvas app and use the Powerapps Value Function in it.

  • Sign in the PowerApps app with your credentials.
  • Create a blank new Canvas app and choose any one Layout either Tablet or Phone.
  • On the Powerapps blank screen, Connect OneDrive for Business Data source to your app (As I have uploaded the Excel spreadsheet in OneDrive).
  • Go to View tab -> Data sources -> Search OneDrive for Business in the search bar -> Add a new or existing connection -> Select your Excel file (Book Purchase Details) -> Choose Excel table name (Book Details) -> Hit on Connect button. Then the Excel spreadsheet will connect to the app as shown below.
Convert text to number using PowerApps Value Function
PowerApps value function

Step-5:

On the Powerapps screen, Insert these below Powerapps input controls as:

  • Insert four Labels. One Label is for the title (Book Purchase Details) and the others are for three input fields (Book Name, Location, and Book Price). Select individual Label and set its Text property to “Book Name: “, “Location: “ and “Book Price: “.
  • Add three Text input controls for 3 input fields and set all text input’s Default property to blank. Rename all text input controls to “txtBookName“, “txtLocation” and “txtBookPrice“.
  • Insert one Button that will help you to save the user inputs in the Excel sheet. Select the button and set its Text property to Save.

After adding all the input controls in the Powerapps app, the screen looks like the below screenshot:

powerapps convert text to number
Value function PowerApps

Step-6:

Select the Save button and apply this below formula on its OnSelect property as:

OnSelect = Patch(
    BookDetails,
    Defaults(BookDetails),
    {
        BookName: txtBookName.Text,
        Location: txtLocation.Text,
        BookPrice: Value(txtBookPrice.Text)
    }
);

Where,

  • Patch = This Powerapps Patch function helps you to update the record in the Data source.
  • BookDetails = Excel Table Name where the user inputs will store.
  • Defaults(BookDetails) = This Default function helps you to create a new record in the Excel Table (Book Details).
  • BookName: txtBookName.Text = BookName represents the Excel table Column name and txtBookName.Text represents the Book name text input control name.
  • Location: txtLocation.Text = Location represents the Excel table name and txtLocation.Text represents the Location text input control name.
  • BookPrice: Value(txtBookPrice.Text) = BookPrice represents the Excel table name and txtBookPrice.Text represents the Book Price text input control name.

If you are interested to know more details about the patch function, then refer to this link: PowerApps Patch Function.

convert text to a number in Powerapps
Value function Power Apps

Step-7:

  • Just Save and Preview (F5) the app. Enter Book Name, Location, and Book Price field details and then hit Save the button.
Powerapps convert text to a number
how to use powerapps value function
  • Next, go to your OneDrive account and refresh it. Open your specific Excel sheet (Book Purchase Details), you can see the new record will save with the Book Price including the currency format as shown below:
How to convert a text to number in Powerapps
how to use powerapps value function

Convert Date to Text in PowerApps

In this scenario, We will see how to convert a Date to Text or String in PowerApps form.

Suppose you have a Date picker field in a Powerapps form. You want to convert the Date from the date picker to the “dd mmmm yyyy” format. Like, “9-3-2020” would be converted to “3 September 2020”.

To convert these Date to Text things, We need to follow these below steps as:

  • The below screenshot represents a Powerapps Edit form where I have a Date Picker column named “Project Created Date“. Here, I want to convert the Date to Text format.
Convert Date to Text in PowerApps
Convert Date to Text in PowerApps
  • Insert one Label control below the Date picker and apply this below formula on its Text property as:
Text = Text(DataCardValue5.SelectedDate, "[$-en-US]d mmmm yyyy")

Where,

  • Text = Powerapps Function name that helps to convert a Date to Text
  • DataCardValue5 = Date Picker control name
  • “[$-en-US]d mmmm yyyy” = This is the format that you want to convert a Date to text

The below screenshot is for your reference.

powerapps convert date to text
Convert Date to Text in PowerApps

NOTE:

If you are not getting the output in the Label, just Save and publish the app and then close it. Now, Play the app, In the Label control, you can see the Date will appear with a Text format as like the above screenshot.

Similarly, If you want to display the Date text format within your Date picker control only, then do this below things as:

  • Select the Date picker control and apply this below formula on its Format property as:
Format = "d mmmm yyyy"

Where,

  • “d mmmm yyyy” = This formula will help you to convert from Date to Text. If you will put “dd” instead of a single “d“, then the output will appear as “03“.

As I have applied a single “d“, that’s why the output is displaying as only “3” as shown below.

convert date to text in power apps
How to Convert Date to Text in PowerApps

If you are interested to know more about how to use Date Time picker in Powerapps, then refer to this below link:

Powerapps convert month number to text

Suppose in Powerapps, you want to extract the month name from a date picker field and that should be converted with the Text format. Let us take an example.

There is a Date picker field in your Powerapps form. The Date format is present like “5/3/2020” i.e. May 5, 2020. Here, you want to extract only the month from this date picker and that should be in text format i.e. “May“.

To convert the month number to text in Powerapps, follow these below things as:

  • The below screenshot represents the Powerapps form that is having with a Date picker field (“Project Created Date“) and I want to extract the month only (with text format).
Powerapps convert month number to text
Powerapps convert month number to text
  • Insert one Label control below the Date picker and apply this below formula on its Text property as:
Text = Text(DataCardValue5.SelectedDate,"[$-en-US]mmmm")

Where,

  • Text = Powerapps Function name that helps to convert a Date to Text
  • DataCardValue5 = Date Picker control name
  • “[$-en-US]mmmm” = This is the formula that helps to extract the month (with text format) from the date picker field

Refer the below screenshot:

Extract month name from a date field in Powerapps
Powerapps convert month number to text

In the above screenshot, as the Date picker field is having August month i.e. 8, So in the Label control, it is extracting and showing as August.

Also, you may like these below Powerapps Tutorials:

In this PowerApps Tutorial, We discussed the PowerApps value function, An introduction about the Powerapps Value function, and What is the syntax of the PowerApps Value Function.

Also, We saw how to use this Value Function in PowerApps using different types of formulas.

Also, We covered these below topics as:

  • How to convert text to number in Powerapps
  • How to convert Date to Text in PowerApps
  • Powerapps convert month number to text or Extract month name from a date field in Powerapps
>