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

Syntax for using rounding inside a 'select' action for rounding

Can someone help with syntax, please. 

I want to round the significant figures out a calculated SharePoint column to 0. As in this post, the SharePoint returns a text value and I want to convert the dynamic field item()['DaysLeft'] inside a 'select' action. 

 

How do I make the following expression work?

div(float(int(mul(div(variables('Sum'),5),10))),10)

I tried substituting  variables('Sum') with item()['DaysLeft] but no luck.
Is there a more elegant solution?

 

Any help appreciated. Thanks. 

10 REPLIES 10

Actually, just dropping your insignificant digit probably isn't exactly what you want - you'd rather round it, I guess.

Unfortunately, Flow doesn't have any number rounding that I know of (hint, hint), but I have hope that it will sometime soon.

Meanwhile, here's a more complete solution with rounding your insignificant digits. The strategy to rounding is to add 1 if the decimal is above 0.5 before dividing, instead of just substracting the decimal.

 

 

div(
  add(
    mul(float(item()?['DaysLeft']), 10), 1),
    if (
      greater(
        mod(mul(float(item()?['DaysLeft']), 10), 1),
        0.5
      ),
      1,
      0
    )
  ),
  10
)

 

 

 

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (69,727)