Number.Power
Raises a number to a power, such as a growth factor for compounding over several periods.
Number.Power(base as nullable number, exponent as number) as nullable numberReturns: The base raised to the exponent, or null when the input is null.
What it does
Number.Power raises a base to an exponent. The main finance use is compounding: a growth or discount factor applied over several periods. For example, a balance growing at a rate for three years is multiplied by the rate's factor three times, which is the same as raising the factor to the power 3. The function does the repeated multiplication in one step.
Syntax and arguments
- base: the number to raise, such as a growth factor.
- exponent: the power. A whole number of periods is the usual case.
Example
An investment of 1000 dollars earns a fixed growth rate per year. The team computes the value after several years by raising the yearly growth factor to the number of years.
let
Principal = 1000,
GrowthFactor = 2,
Years = 10,
Value = Principal * Number.Power(GrowthFactor, Years)
in
Value
A factor of 2 raised to the power 10 is 1024, so the result is 1,024,000. The example uses a factor of 2 to keep the arithmetic exact. A real rate such as 1.05 works the same way, and the answer is then rounded for display.
Example: a second, different use
Turn an annual rate into a monthly rate for a loan by raising the annual factor to the power one twelfth. Name the rule in the model so the rate can be checked.
Things to watch
- Compounding with a factor is not the same as adding a rate each year. Check the rule in the contract before you use it.
- Fractional exponents, such as one half, give roots. Use Number.Sqrt for square roots.
- Round the result for display with Number.Round, but keep the full value for further calculation.
- Null in gives null out.
In business terms
Compound growth, interest, depreciation rates and present value factors all rely on powers. Making the factor visible in the query lets a controller check the rate and the period count against the agreement.