In this section from my Power Automate I initialise two variables (currentscore and maxscore) with values using the Set variable action. I want a third variable, sspercentage, to be equal to:
(currentscore) / (maxscore) * 100
that is, a percentage but with only two decimal places. To do that I need to use the following formula in the Set variable 3 action:
which you will note, if you look carefully, actually results in sspercentage being a string not a float!
handles the division
multiples the division by 100 to get the percentage value.
The 0.00 in the formula is the actual formatting that you can adjust if you need and the en-US is the language format for the number. The Microsoft reference is for the formatnumber function is here:
The end result looks like:
If the formatnumber function is not used then the result contains a lot of numbers after the decimal place and remains of type float, which I would only need if I wanted to display the value of Pi!