Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Description

This step allows you to peek forward and backwards across rows. Examples of common use cases are:

  • Calculate the "time between orders" by ordering rows by order date, and LAGing 1 row back to get previous order time.
  • Calculate the "duration" of a web page view by LEADing 1 row ahead and determining how many seconds the user was on this page.

Options

Option

Description

Step name

The name of this step as it appears in the transformation workspace. Note: This name must be unique within a single transformation.

Group fields table

Specify the fields you want to group. Click Get Fields to add all fields from the input stream(s). The step will do no additional sorting, so in addition to the grouping identified (for example CUSTOMER_ID) here you must also have the data sorted (for example ORDER_DATE).

Analytic Functions table

Specify the analytic functions to be solved.

New Field Name

the name you want this new field to be named on the stream (for example PREV_ORDER_DATE)

Subject

The existing field to grab (for example ORDER_DATE)

Type

Set the type of analytic function:
Lead - Go forward N rows and get the value of Subject
Lag - Go backward N rows and get the value of Subject

N

The number of rows to offset (backwards or forwards)

Examples

These are the examples that are available in our distribution:

samples/transformations/Analytic Query - Lead One Example.ktr
samples/transformations/Analytic Query - Random Value Example.ktr
  • No labels