topic Re: Round off to two decimal places using Power Automate in Power Automate Cookbook
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/586554#M100
<P>I was looking for a Power Automate equivalent to Excel's Round() function, when I stumbled upon this - at first it looked great, but after some testing, I have found two issues:</P><P> </P><P>1. it cannot handle numbers that have fewer decimal places than you're trying to round off to (i.e. the number of decimal place you check against in the "Do until" action)</P><P>2. it doesn't correctly handle numbers where the first decimal place is a 0 </P><P> </P><P>Example 1:</P><P> </P><P>enter 1.1 (where the Do until action is trying to round to 2 decimal places)</P><P> </P><P>results in the flow failing</P><P> </P><P> </P><P>Example 2:</P><P> </P><P>enter 1.0126543678992 </P><P> </P><P>the result returned by the flow is 1.126544</P><P>the correct result should have been 1.012654</P>Fri, 05 Jun 2020 16:33:16 GMTbetterpractices2020-06-05T16:33:16ZRound off to two decimal places using Power Automate
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/440451#M14
<P>This Flow takes a float value as an input and appropriately rounds off to two decimal places. </P>Wed, 08 Jan 2020 19:13:31 GMThttps://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/440451#M14yashag22552020-01-08T19:13:31ZRe: Round off to two decimal places using Power Automate
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/586554#M100
<P>I was looking for a Power Automate equivalent to Excel's Round() function, when I stumbled upon this - at first it looked great, but after some testing, I have found two issues:</P><P> </P><P>1. it cannot handle numbers that have fewer decimal places than you're trying to round off to (i.e. the number of decimal place you check against in the "Do until" action)</P><P>2. it doesn't correctly handle numbers where the first decimal place is a 0 </P><P> </P><P>Example 1:</P><P> </P><P>enter 1.1 (where the Do until action is trying to round to 2 decimal places)</P><P> </P><P>results in the flow failing</P><P> </P><P> </P><P>Example 2:</P><P> </P><P>enter 1.0126543678992 </P><P> </P><P>the result returned by the flow is 1.126544</P><P>the correct result should have been 1.012654</P>Fri, 05 Jun 2020 16:33:16 GMThttps://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/586554#M100betterpractices2020-06-05T16:33:16ZRe: Round off to two decimal places using Power Automate
https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/587638#M103
<P>In an attempt to fix the two issues mentioned, I stumbled upon a third issue - the approach taken to rounding is basically not correct, as it always rounds every number in reverse one by one.</P><P> </P><P>This issue can be seen if you try to round 0.4949 to two decimal places - the correct result is 0.49, however the flow will return 0.50. </P><P> </P><P>The reason why the flow returns 0.50 is that it always rounds the last decimal place:</P><P>- Step 1: 0.4949 is rounded to 0.495</P><P>- Step 2: 0.495 is rounded to 0.50</P>Sun, 07 Jun 2020 09:38:28 GMThttps://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Round-off-to-two-decimal-places-using-Power-Automate/m-p/587638#M103betterpractices2020-06-07T09:38:28Z