Expand my Community achievements bar.

Audience Conditions for Dates in Past and Future

Avatar

Level 3

Hi,

I have a time-sensitive request and would appreciate any quick guidance.

 

I’m trying to build an audience with a condition that checks if a user's start_date is before today and end_date is after today - essentially qualifying users who are currently active. However, I couldn’t find an option in the audience builder to compare dates directly against “today.”

 

Does anyone have recommendations on how to implement this?

 

Thanks in advance!

1 Reply

Avatar

Level 6

Hi @trojan_horse ,

Use the Now token in the UI

Drag your start_date attribute onto the canvas.

Set the operator to is on or before and, in the date picker, choose Now (this represents the current timestamp).

Drag your end_date attribute onto the canvas.

Set the operator to is on or after and choose Now again.

Combine these with AND, and you’ve got exactly:

start_date <= Now
AND
end_date >= Now

This Now option is part of AEP’s time-constraint features in the Segment Builder UI

 

Use PQL in Code View

If you prefer to work in code or need to manage this programmatically, switch to Code view in the Segment Builder and you’ll see (or can edit) the equivalent Profile Query Language and add definition. You can then push this definition through the Segmentation API’s /audiences endpoint

 

Reference:

https://experienceleague.adobe.com/en/docs/platform-learn/tutorials/audiences/time-constraints

https://experienceleague.adobe.com/en/docs/experience-platform/segmentation/ui/segment-builder

Note: This response is inspired from Generative AI.

 

Thanks

Ankit