Skip to content

Decimal Running NPV

Steve Schafer edited this page Mar 18, 2024 · 2 revisions

Use in place of the built-in RUNNINGNPV aggregation to avoid tiny errors that can be introduced by floating point math.

This aggregator calculates the result by using the BigDecimal add and divide methods. It changes the column binding data type to DECIMAL, although you can change it to something else after.

An additional parameter is Rate, which is an expression that returns a double precision floating point value. This value is ignored for all rows except the first.

This is a running aggregation, which means you should it on the same grouping level as its source values.