Using Additional Dates for Calculations

In some cases, you may include extra date values with your transactions or custom events - for example, storing the opt-in time on a member’s profile. These dates can later be used for various types of calculations and segmentation.

Below are some example expressions showing how to work with such dates. While the examples use custom attributes from transactions (transaction.labels), the same logic applies to attributes stored on the member’s profile (customer.labels).

Checking the Month

To determine if a custom date (e.g., 'custom_date') falls within a specific month, use:

month(to_date(agg(transaction.labels).getLabelValue('custom_date'))) == 'April'

Checking the Day of the Week

To check if a custom date falls on a weekend (e.g. Saturday or Sunday), use:

day(to_date(agg(transaction.labels).getLabelValue('custom_date'))) in ["Saturday","Sunday"]

Checking the Time of Day

To check if a custom date falls between specific hours (e.g., between 6:00 and 9:00), use:

is_time_between(to_date(agg(transaction.labels).getLabelValue('custom_date')),to_date('06:00'),to_date('09:00'))

Last updated

Was this helpful?