Solved

# What does "within" mean in event segment?

• 3 replies
• 103 views

• New Member

Hi,

I read about within on the document, but I couldn’t understand what does it mean exactly.

• Within. Looks at events fired within each cohort member's X days of first use. This is useful when you're interested in the group of users who fired a specific event within X days of becoming a new user.

Given events:

date user_id event
2021-05-01 1 Purchase Song or Video
2021-05-02 1 Play Song or Video

The user_id 1 is picked by the below condition. Right?

Can I get some more detailed explanations for the “within”?

icon

Best answer by Saish Redkar 26 May 2021, 17:53

Hey Philip,

Andreas has a great explanation on how the “within” clause works here.

To simplify further, let’s consider two users 1 and 2 and who were new on 05/01.

date user_id event
2021-05-01   1 Purchase Song or Video
2021-05-01   1 Play Song or Video
2021-05-01 2 Play Song or Video
2021-05-06 2 Purchase Song or Video

So, as per the condition, only user 1 would be pulled into the chart since user 1 performed “Purchase Song or Video” event within the 1 day time duration, and not user 2.

Let me know if this helps!

View original

### 3 replies

Userlevel 1

Think of it in 2 steps

1. Defining user group
2. Determine events fired by that user group

Step 1

As far as I can tell, “within 1 days” means you’re looking at a group of users who have performed your specified event (Purchase Song or Video >= 1 time) within 1 day of first use.

I’m 90% sure that “first use” means the first event (most likely “[Amplitude] Start Session”)

I’m not entirely sure about the “in the past 90 days” part. My guess is that you’re only looking at “New users” within the past 90 days (excluding those who’ve visited prior).

Step 2

After finding the user group, you’re determining how many users have performed “Play Song or Videos” event (if chart is set to “Uniques”).

Given your 2 events, we can’t determine if the user is included or not. The first event is related to Step 1 whereas the 2nd event is related to Step 2

What you need for Step 1 is the timestamp of the very first event of the user + your filtering event (“Purchase Song or Video”). And of course the user needs to be considered “New” within the past 90 days.

That’s my understanding of it, after a bit of digging :)

Userlevel 6
+4

Hey Philip,

Andreas has a great explanation on how the “within” clause works here.

To simplify further, let’s consider two users 1 and 2 and who were new on 05/01.

date user_id event
2021-05-01   1 Purchase Song or Video
2021-05-01   1 Play Song or Video
2021-05-01 2 Play Song or Video
2021-05-06 2 Purchase Song or Video

So, as per the condition, only user 1 would be pulled into the chart since user 1 performed “Purchase Song or Video” event within the 1 day time duration, and not user 2.

Let me know if this helps!

@andreas_heden @Saish Redkar

It’s clear! Thanks all~