Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Get a decimal result when dividing numbers in Power Automate

Posted on April 6, 2022April 10, 2022 by Tom

“I’m dividing two numbers to convert ticks to days but Power Automate gives me only full days as a result, ignoring the decimal numbers!”


If you divide numbers in Power Automate, e.g. to convert ticks to days to get a time difference, you’ll use the div(…) expression. But there’s a small inconvenience using it. By default, if you divide two whole numbers, it’ll return a whole number. It won’t return a decimal result, just the whole number part. Instead of 0.5 you’ll get a 0, instead of 2.3 you’ll get 2, etc. That’s not very helpful, especially if you’re trying to calculate some percentages.

How do you then tell it to return also the decimal part of the result?

Use decimal number as an input

The reason is that the expression keeps the input data type. You entered two whole numbers (integers), it’ll return another whole number (integer).

Since the expression sticks to the original input type, you must change the input. Instead of using two whole numbers convert one of them into a decimal number (float). Applying the float(…) expression will convert the input number, and together with that also the division result. It doesn’t matter which input it’ll be, you can pick any of them.

float(<number>)

Note: <…> is a placeholder, replace it including the < and >.

Following with the example from above, the difference between now and 12 hours ago is 0.5 days, not a 0.

Power Automate dividing numbers decimal

Summary

When dividing numbers in Power Automate, you should always consider converting one of them into a decimal number (float). The result will be another decimal number and you won’t miss any piece of information (especially if you’re trying to calculate percentages).


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes