Expressions: Aggregations On The Fly - Pattern Match Any Matched Pattern
The Pattern Match function allows you to specify a set of transactional patterns in order of priority, and then identify records with that same pattern of transactions. We might, for instance, want to find people who have purchased 3 of the same policies consecutively; alternatively, you may be interested in people who have purchased Policy A, then B, then C and finally D.
As well as working on a 'first matched' basis, you can also look to find 'any matched' pattern(s).
For example, you might want to identify the second occurrence of the matched pattern or, perhaps, the most recent.
This feature allows you to specify:
• The order in which patterns match (e.g. first or last).
• The number of the pattern matched.
• How to sort the matched patterns.
The following Expression can be used to identify people who have at least one occurrence of the destinations visited pattern of Australia-United States:
-
Open a new Expression window and click on the
Add Aggregation icon
To access the ‘on the fly’ options:
-
Click onto the Frequency(Bookings) tab and apply settings as per screenshot below
To determine the number of people who have more than one occurrence of the AUS-US pattern:
-
Open a new People level selection
-
Drag and drop the Expression onto the selection and set a value of >1
-
Build
To verify the results:
-
Drag and drop a Data Grid onto the selection
-
Add Booking Date and Destination and group by Person URN
-
Sort Ascending by Booking Date
The Pattern Order Span option allows you to determine the difference between the start and end date of a pattern. In order to establish the smallest time span for the AUS-US pattern, it is necessary to sort the patterns by the Date Span and return the Smallest value:
-
Return to the Aggregation tab within the Expression window and apply the following settings
-
Rename the Expression – e.g. AUS-US Order Span
-
Drag and drop the Expression onto the Data Grid
To further refine the results:
-
Drag and drop the Expression onto the selection as an ANDed clause
-
Set a value of <=7 and Build
The updated Data Grid now displays the smallest time span in days for an AUS-US pattern of transactions that a person has, but only when the defined pattern has occurred within a 7-day period.
Related topics:
Expressions: Aggregations On The Fly - Pattern Match
Expressions: Aggregations on the Fly.