kire38
kire38

Reputation: 75

Round to The Nearest within PowerQuery

How to round to the nearest;

For example formular we use ceiling(10,30) within excel which would give us 30, how do we do that within PowerQuery to get the same results?

Upvotes: 1

Views: 1648

Answers (1)

ACCtionMan
ACCtionMan

Reputation: 511

Number.Round()

Full details here:

https://learn.microsoft.com/en-us/powerquery-m/number-round

Additional Info as you've mentioned Round in the Subject and problem detail, but then used Ceiling as well. I don't think Ceiling exists in M, so you will have to use some extra math such as the following.

(Number.RoundUp([number]/30))*30

In the above formula, [number] is your starting number and 30 represents the significance. On some test data:

  • 22.2 becomes 30
  • 44 becomes 60
  • 91 becomes 120

Upvotes: 2

Related Questions