cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Round decimal figures

Hi all, 

 

In Sharepoint I have a calculated column for number of days left to do an operation. Flow sees it as a string. How do I round that number to integer with a 'select' action?


Thanks for assisting. 

 

Capture.PNG

3 REPLIES 3
v-bacao-msft
Community Support
Community Support

Hi @Anonymous,

 

You could try to convert it by using the int() function.

Like:int(Dynamic content)

 

75.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-bacao-msft

 

thanks for the suggestion. Here is the error I get:

 

InvalidTemplate. The execution of template action 'Select' failed: The evaluation of 'query' action 'where' expression '{ "DaysLeft": "@item()['DaysLeft']", "DaysLeftRounded": "@int(item()['DaysLeft'])" }' failed: 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

There is this thread with more details, I inadvertently created another request. 

Wilhelm
Frequent Visitor

I'd select it as is, and then compose it into an integer.

Here's a recipe I use to round numbers - you'll notice I change the number to a string, then split on the decimal point, and then turn it back into an integer. (You won't need the multiply and divide by 100.)

The value I'm rounding is varMonthlyAmount.

I'm rounding to two decimal places, hence multiply and divide by 100.

 

div(int(first(split(string(add(mul(variables('varMonthlyAmount'),float(100)),0.5)),'.'))),float(100))

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,777)