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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (30,822)