How to Convert Decimal to Integer in Power Automate?

Do you want to convert decimal to integer in Power Automate? In this Power Automate tutorial, we will see how we can convert decimals to integers or whole numbers.

Here, we will cover the topics below

  • How to convert decimal to integer using Power Automate expression
  • How to convert decimal to integer using Power Automate custom format
  • How to convert decimal to integer using Power Automate standard format
  • How to remove decimal places in Power Automate
  • How to convert decimal to integer dynamically in Power Automate

Power Automate convert decimal to integer

Convert decimal to an integer using Power Automate expression

Here, we will see how to convert a decimal to an integer using the Power Automate expression.

For example, we have a decimal number, i.e. 12.89, and we need to convert it to a whole number, so the result will be 13.

Now, let’s create a flow that will convert decimals to integers in Power Automate.

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

how to convert a decimal to a whole number power automate

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

how to convert a decimal to integer power automate

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

convert decimal to whole number in Power Automate

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

  • Name: Provide the name of the variable
  • Type: Provide the type as Float
  • Value: Provide the decimal number
power automate convert decimal to integer

3. Next, we will convert the decimal number to an integer; for this, click on +New step -> select Compose action. Then provide the below information:

  • Inputs: Provide the below expression:
if(greaterOrEquals(Mod(variables('varDecimal'),1),0.5),add(int(first(split(string(variables('varDecimal')),'.'))),1),first(split(string(variables('varDecimal')),'.')))
How to convert decimal to whole number in Power Automate

4. Run the flow manually; you can see the decimal number converted to a whole number.

how to convert decimal to whole number

This is how to convert a decimal number to an integer in Power Automate.

Convert decimal to an integer using Power Automate custom format

Here, we will see how to convert decimal to integer using Power Automate Custom format.

See also  Argument 'Body' must be 'Binary' - Power Automate Desktop error

We will see two methods to use a custom format to convert decimal to integer in Power Automate.

  1. Format number action
  2. Format number function

For example, we have a decimal number 12.89, and we will convert it into a whole number, i.e. 13. To do this, we will use the custom format, i.e. # or #0.

Method 1: Format Number action

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

how to convert a decimal to a whole number power automate

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

how to convert a decimal to integer power automate

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

How to convert decimal to whole number in Power Automate

2. Initialize a variable to store decimal numbers; 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 Float
  • Value: Provide the decimal number
power automate convert decimal to integer

3. Now, we will convert the decimal to a whole number; click on the +New step -> select Format Number action. Then provide the information below

  • Number: Select the number from dynamic content.
  • Format: provide the format as #.
decimal to whole number in Power automate

4. Now, run the flow manually, and you can see the decimal number is converted to a whole number.

decimal to whole number Microsoft Power automate

Method 2: Format number function

Here, we will see how we can use the custom format in formatNumber() to convert decimal to whole numbers in Power Automate.

Add the Compose action instead of the Format number action in the above flow. Then provide the information below

  • Inputs: Provide the below expression:
formatNumber(variables('varDecimal'), '#')

or

formatNumber(variables('varDecimal'), '#0')
decimal to whole number in Microsoft Power automate

Now if I run the flow, you can see the decimal number is converted to an integer.

decimal to whole number Power automate

This is how to convert decimal to integer using Power Automate Custom format.

Convert decimal to integer using Power Automate standard format

Here, we will see how to convert decimal to integer using Power Automate standard format.

We will see two methods to use a standard format to convert decimal to integer in Power Automate.

  1. Format number action
  2. Format number function

For example, we have a decimal number 12.89, and we will convert it into a whole number, i.e., 13. To do this, we will use the standard format, i.e. N0.

See also  Power Automate Convert String to Float

Method 1: Format Number action

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

how to convert a decimal to a whole number power automate

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

how to convert a decimal to integer power automate

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

convert decimal to whole number in Power Automate

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

  • Name: Provide the name of the variable
  • Type: Provide the type as Float
  • Value: Provide the decimal number
power automate convert decimal to integer

3. Now, we will convert the decimal to a whole number; for this, click on the +New step -> select Format Number action. Then provide the information below

  • Number: Select the number from dynamic content.
  • Format: provide the format as N0.
decimal to whole number using Power automate

4. Now run the flow manually, and you can see the decimal number is converted to a whole number.

how to turn a decimal into a whole number in Microsoft Power automate

Method 2: Format number function

Here, we will see how we can use the standard format in the formatNumber() function to convert decimal to whole numbers in Power Automate.

Add the Compose action instead of the Format number action in the above flow. Then provide the information below

  • Inputs: Provide the below expression:
formatNumber(variables('varDecimal'), 'N0')
decimal to whole number using Microsoft Power automate

Now, if I run the flow manually, you can see the decimal number is converted to an integer.

how to turn a decimal into a whole number Microsoft Power automate

This is how to convert decimal numbers to Whole numbers in Power Automate.

Convert decimal to integer dynamically in Power Automate

Here, we will see how to convert decimal numbers from Sharepoint lists to integers in Power Automate.

For example, we have a Product list containing 2 columns: Name(Single line of text) and Price (Number).

how to convert a decimal to integer in power automate

We will convert the price values that are in decimal numbers, which will convert it into the whole number.

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

how to convert a decimal to a whole number power automate

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

how to convert a decimal to integer power automate

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

How to convert decimal to whole number in Power Automate

2. Next, we will get 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.
how to turn a decimal into a int Power automate

3. Next, we will convert the decimal number to an integer; for this, click on +New step -> select Format Number action. Then provide the below information:

  • Number: Select the Price column from dynamic content. It will automatically add Apply to each action to the flow.
  • Format: Select Enter custom format, then provide the format as N0.
 decimal into a int Power automate

4. Now, run the flow manually, and you can see the decimal numbers are converted to whole numbers.

decimal into a int in  Power automate

This is how to convert the decimal to whole number using power Automate dynamically.

See also  Power Automate SharePoint Get items filter query contains is not valid

How to remove decimal places in Power Automate

Here, we will see how we can remove decimal places in Power Automate.

For example, we have a decimal number 12.89, and we will convert it into a whole number i.e., 12.

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

how to convert a decimal to a whole number power automate

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

how to convert a decimal to integer power automate

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

How to convert decimal to whole number in Power Automate

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

  • Name: Provide the name of the variable
  • Type: Provide the type as Float
  • Value: Provide the decimal number
power automate convert decimal to integer

3. Now, we will remove the decimal places; click on Add an action -> select Compose action. Then provide the below information:

  • Inputs: Provide the below expression
substring(string(variables('varDecimal')),0,add(indexof(string(variables('varDecimal')),'.'),0))
how to turn a decimal into a whole number in Power automate

4. Now, run the flow manually, and you can see the decimal places are removed from the decimal number.

how to turn a decimal into a whole number Power automate

This is how to remove decimal places in Power Automate.

Conclusion

In this Power Automate tutorial, we saw how to convert a decimal to an integer using Power Automate. We saw a few examples of “Power Automate convert decimal to integer”

You may also like:

>