cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MLM
Frequent Visitor

Round a Float

I need to round the value of a number that the flow will get from a file property.

What I want is to get this float x.yz and tranform it into x.00 (or an integer).

 

I have tried to use Int() but it seems it doesn't work.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @MLM 

 

Please see the screenshot below:

int.PNG

Expression:

int(first(split(string(variables('ee')),'.')))

This converts the float to string and extracts the part before the decimal and then converts that to int. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

14 REPLIES 14

Hi @MLM 

 

Please see the screenshot below:

int.PNG

Expression:

int(first(split(string(variables('ee')),'.')))

This converts the float to string and extracts the part before the decimal and then converts that to int. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

This works.

Great Thank you!


@yashag2255 wrote:

Hi @MLM 

 

Please see the screenshot below:

int.PNG

Expression:

int(first(split(string(variables('ee')),'.')))

This converts the float to string and extracts the part before the decimal and then converts that to int. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!


 

This is a ridiculous workaround. Why doesn't MS Flow just have Round functions built-in? I have to instantiate TWO variables and have a five nested function calls? Absolutely absurd.

hjaf
Kudo Collector
Kudo Collector

absolutely agree with this.. i'm dealing with excel datetime columns which already provides an excellent amount of confusion with their serialized time. Seems like the only way to convert it to an understandable datetime for flow, I have to do something similar to this..
having to convert a floating point to a string and then back to int and float is mindbogglingly absurd.

 

The way datatypes are being dealt with is causing so much annoyance and frustrations 😕 

 

/rant 

Hi @hjaf , And folks visiting this thread now, 

 

A new action named Format Number has been introduced in Power Automate that can be directly used now to format a number (decimals/ currency/ commas etc). You might want to check that out as well. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

mizsei
Advocate I
Advocate I

This not a solution! This only can be good, if you want a trunc function. I don't know how to deal with this.

irondinges
Advocate III
Advocate III

I worked around this ridiculous issue by doing a manual round up by addition.

1. Divide your number

2. Add 0.5 (if you want to round to nearest) or 0.9999 (if you want to round up, as I did in my case. Will have to configure based on your data/accuracy desired)

3. Convert to int, which will chop off everything beyond the decimal.

 

My use case for this was to calculate how many SMS's a message will split into (as there is a limitation of 153 characters), and it was important for me to have 154 characters become 2 SMS's (round up).

@irondinges  your workaround is a perfect solution. Thank you!

Billy_C
Helper V
Helper V

Hi,

 

It seems that rounding functions are still not included in Power Automate nor Powerapps.
I do not understand why this is not yet implemented, even excel has more functions then powerapps can provide.
This cannot be right, a product as powerapps has so much potential with all these complexities built-in, but most common used and simplest of things are not implemented and rather thrown away.
I understand what the goal is for powerapps but I feel like the most important basic parts are being forgotten.
If I create an app in Powerapps It would takes 10x maybe even more time longer then it is to make the same app in excel. Ofcourse powerapps has the possibility to have many more connections and it is a good thing but instead it would be better to focus to increase its flexibility, use of formulas and its speed cause sometimes powerapps and flows can be really really slow (and no its not due to my internet connection i have an excellent connection so).

Still I don't think that powerapps is bad or anything like that, but I would rather say that its still in beta mode and is still far from being a finished product. Which is also why I wouldn't recommend using it just yet, but I might if enough improvements have been made.

 

Can't wait to see how Powerapps will evolve in the future!

 

Thanks in advance,

 

Billy Cottrell

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,806)