In Power Apps, it is possible to define custom functions. These can then be called from other elements, the same way you call any other function.

Defining Custom Functions

In Power Apps, go to the App level and write one or more functions separated by semicolons (or another delimiter depending on your localization). Functions can reference each other.

Example:

  • total_price(pieces:Number, per_piece:Number):Number = pieces * per_piece;
Which means:
  • The name of the function
  • In parentheses, the names of inputs and their expected data types
  • After the parentheses, the data type of the result is specified
  • The calculation itself is written after the equals sign

Using Custom Functions

Custom functions are used in the same way as standard predefined functions are used. For instance:

Note: Depending on when you read this article, these custom functions might still be in Preview mode, and you may need to enable them before use.