Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit is happening now. Discover what's next in customer experience.
SOLVED

Can I create a segment with an aggregate using count between in AEP

Avatar

Level 2

Hi,

 

I am trying to create a segment with audience of count of Unique purchases (SKU's) between 2 and 5 in the last 10 days.

Can I do this in one single segment in AEP?

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee

@an1989 I built this in the UI.

DannyMiller_0-1665099982204.png

 

 

Here is the PQL:

CHAIN(xEvent, timestamp, [C0: WHAT(true) WHEN(<= 10 days before now) COUNT(ALL) WHERE(C0[productListItems.exists(SKU.isNotNull())].count() >= 2 and C0[productListItems.exists(SKU.isNotNull())].count() <= 5)])

View solution in original post

6 Replies

Avatar

Employee

@an1989 A few things to remember:

  1. Segments do not produce an "audience count".  They are rules that define if someone qualifies for membership in a Segment.
  2. You can do a Count of Purchases (not Count Distinct) using Aggregate functions in the UI. https://experienceleague.adobe.com/docs/experience-platform/segmentation/ui/segment-builder.html?lan...
  3. You can do a Count Distinct in PQL.  https://experienceleague.adobe.com/docs/experience-platform/segmentation/pql/array-functions.html?la...
  4. Even though you can do a Count Distinct, this is within the context of a single Array.  I do not think this will do a count Distinct across Events, but it is worth a try.

 

Avatar

Level 2

Thanks @Danny-Miller  for the response.

 

Sorry for not being clear with my question above.  I am trying to find the qualified audience who made more than 2 purchases and less than 5 purchases in last 10 days.

I earlier tried using the aggregate function count, but that doesn't have between option. I can either select greater than or equal to or less than equal to. But not both in the same segment. Is there any alternative approach here?

 

If I do count distinct of product(sku) purchases in PQL, Can I get the qualified audience here?

 

Thanks

Avatar

Level 2

Hi @Danny-Miller , just checking in to see if you have some insight on this?

 

Thanks

Avatar

Correct answer by
Employee

@an1989 I built this in the UI.

DannyMiller_0-1665099982204.png

 

 

Here is the PQL:

CHAIN(xEvent, timestamp, [C0: WHAT(true) WHEN(<= 10 days before now) COUNT(ALL) WHERE(C0[productListItems.exists(SKU.isNotNull())].count() >= 2 and C0[productListItems.exists(SKU.isNotNull())].count() <= 5)])

Avatar

Level 2

Thanks @Danny-Miller . It worked

 

Is there a way we can accommodate the "distinct"  for SKU's ? 

Avatar

Employee

Not sure.  Did you try PQL?

distinct().count()