cancel
Showing results for
Did you mean:
Helper III

## Power automate round up a float value

Hi i have a float value in power automate that i would like to round up. Could someone point me in the right direction

e.g. 0.5 should be 1

1.5 should be 2

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Hi @Esox76,

Sorry I did not consider the case where the decimal place is 0.

``if(less(length(split(string(variables('TT')),'.')),int(2)),int(first(split(string(variables('TT')),'.'))),if(less(int(last(split(string(variables('TT')),'.'))),int(5)),int(first(split(string(variables('TT')),'.'))),add(int(first(split(string(variables('TT')),'.'))),1)))``

Best Regards,
Zhi Chen
11 REPLIES 11
Most Valuable Professional

Use the Round function if you want 0.5 to be 1, 1.5 to be 2 - 0.3 to be 0, 1.3 to be 1, etc.

Round(NumberDecimalPlaces)

• Number - Required. The number to round.
• DecimalPlaces - Required. Number of decimal places to round to. Use a positive value to indicate decimal places right of the decimal separator, a negative value to the left, and zero for a whole number.

Or

Use the RoundUp function if you want it to always round up no matter what so 0.3 to be 1, 1.3  to be 2, etc.

RoundUp(NumberDecimalPlaces)

• Number - Required. The number to round.
• DecimalPlaces - Required. Number of decimal places to round to. Use a positive value to indicate decimal places right of the decimal separator, a negative value to the left, and zero for a whole number.

Example:

Round(7.9,0) would result in the number 8

Round(7.1,0) would result in the number 7

whereas

RoundUp(7.9,0) would result in the number 8

RoundUp(7.1,0) would result in the number 8 again

See if the above helps @Esox76

Helper III

Sorry @poweractivate  but this Round() function is not available in Power Automate

Thanks

Community Support

Hi @Esox76,

Do you want to round up a float in power automate flow?

I assume your float have one decimal place and have a test on my side, please try following workaround.

Here is the expression:

``if(less(int(last(split(string(variables('TT')),'.'))),int(5)),int(first(split(string(variables('TT')),'.'))),add(int(first(split(string(variables('TT')),'.'))),1))``

Best Regards,

Zhi Chen

Helper III

@v-chenzhi Thanks for this i have tested it but  there is a slight bug in that if my value is 5.0 it calculates it as 6 instead of 5. if it's 4.0 then it ok !

Regards Esox

Community Support
Hi @Esox76,

Sorry I did not consider the case where the decimal place is 0.

``if(less(length(split(string(variables('TT')),'.')),int(2)),int(first(split(string(variables('TT')),'.'))),if(less(int(last(split(string(variables('TT')),'.'))),int(5)),int(first(split(string(variables('TT')),'.'))),add(int(first(split(string(variables('TT')),'.'))),1)))``

Best Regards,
Zhi Chen
Helper III

@v-chenzhi Solution works very well Thank You

Esox

Responsive Resident

This blog post solves Round off problems

New Member

I'm a little late to the game, but you can use the "formatNumber(...)" expression in PowerAutomate to accomplish this.

I haven't done extensive testing to confirm proper rounding for large decimals, but 1.5 becomes 2 when using int(formatNumber(1.5, '0')).

Note: '0' is the string used for the number format.  You could also use '#' but I like to use '0' since it's a number and seems more straight forward when reading it.

Frequent Visitor

Thank you Zhi, everything else I tried (and mentioned here) either doesn't work or always rounds down. I will test some more to be sure, but your solution appears to work well. Crazy that there isn't a more straightforward solution such as RoundUp() function that works, but a very impressive workaround.

Announcements

#### Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team

#### Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

#### Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!