Jump to content

Maintaining a constant value while performing an operation with OVER and AllPrevious


Spencer Grissom

Recommended Posts

Hello,

I am attempting an exponential weighted moving average and am having difficulty evaluating the expression properly. My question is if it is possible to maintain a constant value within an OVER/AllPrevious expression.

 

For example, I want to create a calculated column that is the summation of (1-DataTableProperty("Lambda"))Maximum Row-Current Rowfor all previous rows. The result would translate to the following if the summation began on row 4:

(1-Lambda)4-4+(1-Lambda)4-3+(1-Lambda)4-2+(1-Lambda)4-1

If it began on row 5 it would look like:

(1-Lambda)5-5+(1-Lambda)5-4+(1-Lambda)5-3+(1-Lambda)5-2+(1-Lambda)5-1

(Expression is Sum((1-DataTableProperty("Lambda"))^([baseRow] - RowId())) OVER AllPrevious([baseRow]))

 

However, the "Maximum Row" moves along with the range such that the exponents become 4-4, 3-3, 2-2, and 1-1. I am unsure how to maintain a constant maximum row within a range during an OVER/AllPrevious expression. Any help would be much appreciated!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...