cancel
Showing results for
Did you mean:
Helper I

## Random Numbers, Rounding, and Multiplying

Ok, so I am wanting to use the RandomNumbers table to have it create a Random Number to use on my app. Each time the user hits the button, a new Random Number will be generated. I have that part figured out. What I can't seem to find an answer to is the following:

Once I have the Random Number, how do I get it down to 3 decimal places?

Once it is down to 3 decimal places, how do I grab that number from the Data Table and multiply it by another field?

Any help would be greatly appreciated. I've been beating my head against the wall on this for the last couple of hours and my google-fu is not that great on Monday mornings generally.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Use this code instead to get a 3 digit rounded number

``ClearCollect(RandomNumbers, Round(Rand()*1000,0)/1000)``

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

4 REPLIES 4
Helper I

Ok... got the multiplication part figured out... Now I just need to figure out how to generate the random number as 3 decimal places and also have the final multiplied number come out to no decimal places.

Super User

You can make a 3 digit random number using this code.

``Round(Rand()*1000,0)/1000``

To make a number with no decimal places you can do this

``Round(your_number_here, 0)``

Any other questions?

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Helper I

Ok, so the Data Table in the attached screen shot is where I am having the most issue now. I need to get that number to be just 3 decimal places. Currently the way that number is generated and when you press the Button, it runs the ClearCollect(RandomNumbers, Rand()) function that put in. If I can get that number to start showing up as just 3 decimal places instead of the long number it currently pulls, I would be able to finish this app.

Super User

Use this code instead to get a 3 digit rounded number

``ClearCollect(RandomNumbers, Round(Rand()*1000,0)/1000)``

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Announcements

#### Power Apps News & Announcements

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

#### Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,193)