How to Format Number without Decimal in Power Automate?

Are you in need of format numbers without decimals in Power Automate? This Power Automate tutorial will help you format numbers without Decimals using Power Automate.

Scenario:

Recently, I got a requirement to format the numbers without decimals using Power Automate flow. For example, For example, if the value is 60.00% after formatting, it should return the value as 60% without decimal using flow.

Finally, I have to send an email with detailed information about the Product List to the user using the send email (v2) action.

Before creating a flow, we have to create a SharePoint list, so here I am going to use the below SharePoint Product list consisting of,

Column NamesColumn Type
ProductNamedefault title column
ProductQuantityNumber column
ProductPriceNumber column
ProductStatusChoice column
DiscountsInPercentageNumber column
ProductPriceAfterDiscountCalculated Column
power automate format number without decimal

Now, we will create a flow to format the DiscountsInPercentage column values from decimal to without decimal using Power Automate flow.

Format a Number without Decimal in Power Automate

Let us see how to format numbers without decimals in Power Automate flow

Follow the below-mentioned steps:

Step-1:

Create an instant cloud flow with the manual trigger. Select a new step and add a Get items action to get all the items from the SharePoint list.

Expand the get items action and configure the required parameters,

  • SharePoint site address – select the SharePoint site from the dropdown
  • List name – choose the list from the dropdown (I have selected my Product List).
How to format number without decimal in Power Automate

Step-2:

Add a new step, choose the Select data operation, and choose the From Option as a value from dynamic content. Similarly, in the map, enter key and map values from the dynamic content.

See also  How To Get Dataverse List Rows Count Using Power Automate

Here, I have formatted the Product Price value with the below expression to display the price value in a currency format.

formatNumber(item()?['ProductPrice'],'C0')
How to remove decimal places in a power automate

To Format a Percentage value without decimals, use the below expression, which formats the value from 60.00% to 60%.

formatNumber(item()?['DiscountsInPercentage'],'0%')
How to format number without decimal in Power Automate flow

Similarly, ProductPriceAfterDiscount, I have formatted the Product Price value with the below expression to display the price value in a currency format.

formatNumber(float(item()?['ProductPriceAfterDiscount']),'C0')
How to remove decimal places from a power automate

Step-3:

In this next step, we will create an HTML table by selecting the ‘Create HTML table‘ action from the action triggers.

Next, in the From box, select the ‘output’ from the dynamic content for the select data operation action, and in the Columns box, select Automatic.

body('Select')
format number to remove decimal using select before creating a HTML Table for email

Step-4:

Add a compose action to apply the style for the generated HTML table; for that, add the CSS code below.

<style>
table {
  border: 1px solid #1C6EA4;
  background-color: #EEEEEE;
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}
table td, table th {
  border: 1px solid #AAAAAA;
  padding: 3px 2px;
}
table tbody td {
  font-size: 13px;
}
table thead {
  background: #1C6EA4;
  border-bottom: 2px solid #444444;
}
table thead th {
  font-size: 15px;
  font-weight: bold;
  color: #FFFFFF;
  border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
  border-left: none;
}
</style>
format number to remove decimal using select before creating a HTML Table for email in power automate

Step-5:

  • To send an email, select Send an Email (V2) (outlook) action. In The To address, pass the dynamic content user email address.
  • Then, in the body, add outputs of the style-composed action and HTML action from dynamic content.
body('Create_HTML_Table')
Outputs('CSS')
Remove decimal places from a power automate

Step-6:

Save and test the flow manually by selecting the run flow option. Once the flow runs successfully, like below:

Remove decimal places from a power automate flow

In the screenshot below, we received an Outlook email with the HTML table that has been generated and displays the Product List information in detail.

How to format number without decimal in the HTML table using flow

Conclusion

I hope you get an idea to format numbers without decimals using Power Automate flow.

See also  How to Convert String to Date in Power Automate?

I have clearly shown you an example of formatting numbers without decimal places, like values from 60.00% to 60%.using the formatnumber() function in Power Automate.

You may also like the following tutorials:

>