This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
As I heard in many customer conversations, one feature people built for predictive models is a "Lag Feature".
Basically this means pulling a specific value from a specific field from the previous record into a new column of the actual record, looking like this:
As you can see here, for the row 2, for column Lag-1 it pulled down the value from the previous row (1) .
You could achieve this generally by using one (or like in the above picture multipl) Multi-Row Formula Tools within Alteryx. Now, in order to be able to create as many "Lag Fields" that you need, I have created a Lag Record Macro. All you do is, you select how many rows before you want to start "lagging", how many rows you want to lag (essentially how many columns for lags you want to generate) and then select the Field (must be Numeric) which should be lagged, so basically a value field.
Once you have lagged you can also very easily calculate the difference between the actual row value and the lagged values for multiple columns (if you need to) by just using a "Multi-Field Formula" Tool afterwards.
You can download the tool in the Alteryx Gallery, it's a yxi Installer: