How to Convert Percentage to Whole Number in Power Automate?

Do you want to convert the percentage to a whole number in Power Automate? In this Power Automate tutorial, we will see how to convert percentage to whole number in Power Automate.

Here, we will cover the below example in Power Automate

  • How to convert percentages to whole numbers in Power Automate
  • How to dynamically convert percentages to whole numbers in Power automate
  • How to calculate percentages and then convert them into Whole numbers in Power Automate.

How to convert percentages to whole numbers in Power Automate

Here, we will see how to convert percentage to whole number in Power Automate.

For example, we have a percentage i.e. 50%, and I need to convert it to a whole number i.e. 1. The calculation is 50/100 =0.5; now convert to a whole number i.e., 1.

1. Open Power Automate Cloud, then click +Create -> select Instant Cloud Flow.

how to convert percentage to whole number using Microsoft Power Automate

Then, provide the flow name and select Manually trigger a flow action. Click on Create.

how to convert percentage to whole number using MS Power Automate

You can see the “Manually trigger a flow” action is added to the flow canvas.

how to convert percentage to whole number using Power Automate flow

2. Initialize a variable to store percentage; for this, click on +New step, and select Initialize variable action. Then provide the below information:

  • Name: Provide the name of the variable
  • Type: Provide the type as a string
  • Value: Provide the number with a percentage symbol
how to convert percentage to whole number in Power Automate

3. Now, we will remove the percentage symbol; for this, click on +New step -> select Compose action. Then provide the below information:

  • Inputs: Provide the below expression
int(replace(variables('Percentage'),'%', ''))
how to convert percentage to whole number in Microsoft Power Automate

4. We will divide the number with 100 to convert the percentage to decimal; for this, click on +New step -> select Compose action. Then provide the below information:

  • Inputs: Provide the below expression:
div(float(outputs('Compose')), 100)
how to convert percentage to whole number Microsoft Power Automate

5. We will convert the decimal to whole number; for this, click on +New step -> select Format number action. Then provide the below information:

  • Number: Select the output from dynamic content.
  • Format: Provide the format as #0
how to convert percentage to whole number Power Automate

6. Now run the flow manually, and you can see the percentage value you have provided is converted to a whole number.

how to convert percentage to number Power Automate

This is how to convert the percentage to a whole number in Power Automate.

How to dynamically convert percentages to whole numbers in Power automate

Here, we will see how to convert the percentage value from a SharePoint list to a whole number in Power Automate.

For example, we have a SharePoint list called Products, which contains 3 columns i.e. Name, Price, and Discount. In the discount column, the number is formatted in Percentage. So we will get the items and convert the discount percentage to the whole number.

convert percentage to whole number Power Automate

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

how to convert percentage to whole number using Microsoft Power Automate

Then, provide the flow name and select Manually trigger a flow action. Click on Create.

how to convert percentage to whole number using MS Power Automate

You can see the “Manually trigger a flow” action is added to the flow canvas.

how to convert percentage to whole number using Power Automate flow

2. Now get the items from the SharePoint list, for this, click on the +new step -> select Get items action. Then provide the below information:

  • Site address: Provide the SharePoint site address
  • List name: Select the List.
convert percentage to whole number in Power Automate

3. As the percentage in Power Automate comes as decimal, so, we just need to convert it to a whole number, for example, 90% -> 0.9.

Now we will convert the decimal to the whole number; for this, click on the +New step, select Format number action, and then provide the below information:

  • Number: Select the discount column from dynamic content
  • Format: Provide the format #0
convert percentage to whole number using Power Automate

4. Now run the flow manually; you can see the percentages are converted to whole numbers.

convert percentage to whole number using Microsoft Power Automate

This is how to convert the percentage to the Whole number dynamically in Power Automate

Calculate percentages and then convert them into Whole numbers in Power Automate

Here, we will see how to calculate the percentages and then convert them into Whole numbers in Power Automate.

For example, I will take the same Product list from SharePoint. here we will first calculate discounts on Product prices, and then we will get the price after the discounts. At last, we will convert the price to a Whole number.

convert percentage to whole number Power Automate

To do this, follow the below steps

1. Open Power Automate Cloud, then click on +Create -> select Instant Cloud Flow.

how to convert percentage to whole number using Microsoft Power Automate

Then, provide the flow name and select Manually trigger a flow action. Click on Create.

how to convert percentage to whole number using MS Power Automate

Now you can see the “Manually trigger a flow” action is added to the flow canvas.

how to convert percentage to whole number using Power Automate flow

2. Now get the items from the SharePoint list; for this, click on the +new step -> select Get items action. Then provide the below information:

  • Site address: Provide the SharePoint site address
  • List name: Select the List.
convert percentage to whole number in Power Automate

3. Next, Add an Apply to each action and then provide the value from the previous step. Now, we will multiply the price with the discount column; for this, click on Add an action and select Compose action.

Then provide the below information:

  • Inputs: Provide the below expression:
 mul(items('Apply_to_each')?['Price'],items('Apply_to_each')?['Discount'])
convert percentage to whole number Microsoft Power Automate

4. Now we will subtract the original price – discount price = After discount price; for this, click on Add an action, select Compose action. Then provide the below information:

  • Inputs: Provide the below expression:
sub(items('Apply_to_each')?['Price'],outputs('Compose'))
Microsoft Power Automate convert percentage to whole number

5. Now we will convert the decimal value to a whole number; for this, click on Add an action -> select Format number action. Then provide the below information:

  • Number: Select the output from dynamic content
  • Format: Provide the format as ‘#0’
Power Automate convert percentage to whole number

6. Now run the flow manually, and you can see the percentage of price is converted to integer.

how to convert percentage to whole number

This is how to calculate percentages and convert them into Whole numbers in Power Automate.

Conclusion

In this Power Automate tutorial, we saw how to convert a percentage to a whole number in Power Automate.

You may also like:

>