This examples illustrates how you can keep and delete rows from your dataset using the following transforms:
delete- Deletes a set of rows as evaluated by the conditional expression in the
rowparameter. See Delete Transform.
keep- Retains a set of rows as evaluated by the conditional expression in the
rowparameter. All other rows are deleted from the dataset. See Keep Transform.
Your dataset includes the following order information. You want to edit your dataset so that:
First, you remove the orders for old products. Since the set of products is relatively small, you can start first by adding the following:
NOTE: Just preview this transformation. Do not add it to your recipe yet.
When this step is previewed, you should notice that the top row in the above table is highlighted for removal. Notice how the transformation relies on the
ProdId value. If you look at the
ProductName value, you might notice that there is a misspelling in one of the affected rows, so that column is not a good one for comparison purposes.
You can add the other product IDs to the transformation in the following expansion of the transformation, in which any row that has a matching
ProdId value is removed:
When the above step is added to your recipe, you should see data that looks like the following:
Now, you can filter out of the dataset orders that are older than 90 days. First, add a column with today's date:
Keep the rows that are within 90 days of this date using the following:
Don't forget to delete the
today column, which is no longer needed: