top of page

No round() in Power Automate? Here's What to Do Instead (Plus Advanced Math via MathJS)

Updated: Aug 21

If you’ve ever tried to round numbers in Power Automate, you’ve probably discovered something annoying: there’s no built-in Power Automate rounding function.


That’s right. You can’t just do:


round(3.14159, 2)

 

…because it doesn’t exist.

 

But don’t worry - there are workarounds. And suppose you’re looking to go even deeper with math operations (logarithms, powers, roots, algebra). In that case, there’s a powerful solution using the open-source MathJS library included in this blog post as well.

 

How to Round Numbers in Power Automate

Even though there's no official Power Automate round() function, you can still round numbers using the formatNumber() expression:

 

formatNumber(3.14159, '#0.00')

 

outputs 3.14.

 

Need a whole number? Just drop the decimals:

 

formatNumber(3.14159, '#0')

 

outputs 3.

 

This works great for formatting and even for use in simple logic conditions. But if you're doing deeper numeric operations, this approach has its limits.


Want Real Math? Create a MathJS Custom Connector

For anything beyond basic formatting - like:

 

  • round(2.717854, 3) → 2.718

  • pow(5, 6) → 15625

  • log(10000, 10) → 4

  • sqrt(4) → 2

 

You can even use variables/algebra like this, or use the array concept to pass multiple operations at once:


Expression: [ a = 1.2 * (2 + 4.5), a / 2] 

Result: [7.8, 3.9]


How it Works

You pass a math expression (expr) to MathJS via a custom connector. The connector handles the calculation and returns the result.

 

Power Automate Action Definition:

 

Power Automate MathJS Expression Action Definition

 

Power Automate Result:

Power Automate MathJS Expression Result

Key Features of MathJS

  • No API key needed

  •  Supports hundreds of math functions - full list at functions for MathJS

  •  Free service with:

    • 10-second max evaluation time

    • 10,000 requests/day

  • Works well for loops, expressions, conditionals, and calculated values in flows

  • Requires premium licensing

 

How to Create the Custom Connector

You can import the custom connector using the MathJS.swagger.json file. Here's a video on how to import the file.



 

Once imported:

  • Add it as a step in your Power Automate flow

  • Use the expr field to write any valid MathJS expression

  • Get your result directly back in the response

 

As always, if you have any questions or you're looking for Power Platform assistance, just reach out; we're always happy to help.


Happy Building!






 

bottom of page