Hi Justin, currently, there isn't a direct way to compare a User Property Date to "today" within Amplitude. However, you can create a cohort based on a user property with a specific date range, such as "subscription expiry in the next 7 days". You can then update this cohort daily to keep track of all subscribed users whose subscription will expire in the next 7 days. As for your experiment example, you can use the same approach and create a cohort of subscribed users and target them with a specific variant. Alternatively, you can use an external tool to trigger an event in Amplitude when a user's subscription expires, and then use that event to target users in your experiment. I hope this helps!
This is how I thought the situation as well. Thanks for validating my understanding. Then I guess I would like to formally request this be a feature I think it would be very useful, especially as Experiment being such an integral tool in the user experience.
I realized in the Govern Packing (which we do not have) you can specify Derived properties. I believe this would have the effect we want it to.
If you duplicate the timestamp value of the event as an actual event property, it will be available for chart filtering and grouping just like all other event properties. Then, you can then use a derived property to create a property whose value will be TRUE dynamically depending on the date today.
Heres an example I used as a filter on certain charts I needed to keep in sync with internal non-amplitude dashboards. It only returns TRUE of the timestamp and receivedAt values are both before the last time we sync data to the other dashboard. Hope this helps others.
IF(
AND(
TIME_TO_LONG(PROPERTY('timestamp', 'event')) <=
SUBTRACTION(
TODAY(),
MULTIPLY(
86400000,
SWITCH(EVENT_DAY_OF_WEEK(),
"Sunday", 7,
"Monday", 8,
"Tuesday",9,
"Wednesday", 3,
"Thursday", 4,
"Friday", 5,
"Saturday", 6
)
)
),
TIME_TO_LONG(PROPERTY('receivedAt', 'event')) <=
SUBTRACTION(
TODAY(),
MULTIPLY(
86400000,
SWITCH(EVENT_DAY_OF_WEEK(),
"Sunday", 7,
"Monday", 8,
"Tuesday",9,
"Wednesday", 3,
"Thursday", 4,
"Friday", 5,
"Saturday", 6
)
)
)
),
"TRUE",
"FALSE"
)
If you can manage to pass the timestamp of your event as part of the property object, it will be available for chart filtering and grouping just like all other event properties. Then, you can then use a series of derived properties to create a filter you can apply to charts.
Heres an example I built to return FALSE for timestamp or recievedAt values that were greater than a dynamically calculated date which based on what today() is and counting back the appropriate number of days to what the last weekly sync update was for our situation.
IF(
AND(
TIME_TO_LONG(PROPERTY('timestamp', 'event')) <
SUBTRACTION(
TODAY(),
MULTIPLY(
86400000,
SWITCH(
DATE_TIME_FORMATTER(
LONG_TO_DATE(PROPERTY('todayHelperFunction', 'derived')),
"YYYY-MM-dd",
"E"
),
"Sun", 6,
"Mon", 7,
"Tue", 8,
"Wed", 2,
"Thu", 3,
"Fri", 4,
"Sat", 5
)
)
),
TIME_TO_LONG(PROPERTY('receivedAt', 'event')) <
SUBTRACTION(
TODAY(),
MULTIPLY(
86400000,
SWITCH(
DATE_TIME_FORMATTER(
LONG_TO_DATE(PROPERTY('todayHelperFunction', 'derived')),
"YYYY-MM-dd",
"E"
),
"Sun", 6,
"Mon", 7,
"Tue", 8,
"Wed", 2,
"Thu", 3,
"Fri", 4,
"Sat", 5
)
)
)
),
"TRUE",
"FALSE"
)