Segmentation: Using aggregated expressions
Aggregations in expressions that have transaction filter selections, containing relative date rule filters, will have those translated to the appropriate date selection based upon the Today date.
To illustrate the use of aggregations in expressions in the Segmentation tool, a recency aggregation will be used that contains a relative date rule.
In this example, the objective is to view the Last Continent that a person had been to at each of the reporting points set in the Segmentation tool.
-
Open an Expression window and, using Selector Functions, enter the DescOf(.
-
Click on the Add Aggregation button and then switch to the new Frequency(Communications) tab.
-
Change the Type box to Recency.
- Change the Transactional Table to Bookings.
-
Drag the Booking Date variable on to the Order records by drop box.
-
Change the From box to show Latest to Earliest.
-
Drag the Continent-CC (on Holidays this variable is associated with Destination and has been generated via the Combine Categories wizard) onto the Pick the drop box.
-
Change the Name to Last Continent Before Today.
To create the transaction filter that includes a relative date rule:
-
Drag Booking Date onto the workspace and select the Custom Rule option.
-
Select The Earliest Date radio button in the From section, and the Today radio button in the To section.
-
Click OK.
This will result in the 'Today' date being translated by the Segmentation tool to whatever reporting points have been set, and will look at the transactions from that point back to 'The Earliest Date'.
-
Rename the selection Before Today and drag it on to the transactions filter drop box.
-
Click on the Expression tab and complete the expression by adding a closed bracket ).
-
Rename the Expression as Last Continent Visited.
-
Click the Build button to see a preview of the results.
-
Use a Data Grid to validate the results.
To use the above in the Segmentation tool, a series of selections need to be created, representing the Last Continent Visited.
-
Drag the Last Continent Visited expression on to a blank selection window.
-
Enter the value Europe in the right hand panel.
-
Rename the selection Last Europe and save in the Private folder.
-
Repeat the above for Asia, Africa, Americas and Australasia.
These selections can now be analysed in the Segmentation tool.
-
Open the Segmentation tool and drag on the 5 selections previously created.
-
Set the Reporting Points for every 1st January from 2015 onwards.
-
Click on the Time Report tab and click the Build button.
In the screen shot below a grid is displayed with 4 reporting points. The highlighted cell represents those people whose last continent visited before 01/01/2016 was Asia.
You can drag the cell on to the workspace and use a Data Grid to validate the results
In the screen shot above, the people illustrated meet the criteria of visiting Asia as the last continent before 01/01/2016, even though the first and third person went on to visit different continents subsequently.
Return to Segmentation Overview