RoundUp

How to Use the Power Fx RoundUp  Function in Power Apps

In this article, we will explore the Power Fx RoundUp function and how to use it in Power Apps.

What is the RoundUp Function?

The RoundUp function in Power Fx is used to round a number up to the nearest specified multiple. For example, if you want to round a number up to the nearest 5, you can use the RoundUp function to achieve this.

The syntax for the RoundUp function is:


RoundUp(❰number❱, ❰multiple❱)


Here, `❰number❱` is the number you want to round up, and `❰multiple❱` is the multiple to which you want to round up.

How to Use the RoundUp Function in Power Apps

To use the RoundUp function in Power Apps, follow these steps:

1. Open Power Apps and create a new app or open an existing one.

2. Add a text input control to the app by selecting the Text input option from the Insert tab.

3. Rename the text input control to "NumberInput" by selecting it and changing the Name property in the Properties pane.

4. Add a button control to the app by selecting the Button option from the Insert tab.

5. Rename the button control to "RoundUpButton" by selecting it and changing the Name property in the Properties pane.

6. Select the RoundUpButton control and add the following formula to its OnSelect property:


UpdateContext({ RoundedNumber: RoundUp(Value(NumberInput.Text), 5) })


This formula uses the RoundUp function to round the number entered in the NumberInput control up to the nearest multiple of 5. The result is stored in a context variable called RoundedNumber.

7. Add a label control to the app by selecting the Label option from the Insert tab.

8. Rename the label control to "RoundedNumberLabel" by selecting it and changing the Name property in the Properties pane.

9. Select the RoundedNumberLabel control and add the following formula to its Text property:


If(IsBlank(RoundedNumber), “”, “Rounded Number: ” & Text(RoundedNumber))


This formula displays the rounded number in the label control.

10. Save and run the app by selecting the Play button in the top-right corner of the screen.

11. Enter a number in the NumberInput control and click the RoundUpButton control. The app will round the number up to the nearest multiple of 5 and display the result in the RoundedNumberLabel control.

The RoundUp function in Power Fx is a powerful tool for rounding numbers up to the nearest specified multiple. By following the steps outlined in this article, you can easily use the RoundUp function in your Power Apps to round numbers up and perform complex calculations.

Power Apps Training Courses by G Com Solutions (0800 998 9248)