Forum Discussion
Anonymous
8 years agoNot applicable
Create sessions based on timestamp
Hi All, I have some data from GA in which I have session Id and DateTime field. My requirement is to look at the session Id and if the created_timestamp has a time difference of more than 30 mins...
- 8 years ago
Take a look at my MTBF article, it has a similar kind of issue that it is trying to solve. You should be able to use it to create a column that flags a session as new based upon the duration from the previous row.
Anonymous
8 years agoNot applicable
Hi Greg_Deckler,
I tried something like this with the help of your article:
and it retured me the below output. My question now is: How could I distinguish between 16th and 15th. Because for me there is a new session on 16th, if I calculate based on my >30 mins duration there is no session on 16th in that case.
new duration in min =
VAR next = MINX(FILTER ('Talend_GA sessions';
'Talend_GA sessions'[session_id] = EARLIER('Talend_GA sessions'[session_id]) &&
'Talend_GA sessions'[created_timestamp] > EARLIER('Talend_GA sessions'[created_timestamp])
);'Talend_GA sessions'[created_timestamp])
RETURN (DATEDIFF('Talend_GA sessions'[created_timestamp];next;MINUTE))Greg_Deckler
8 years agoCommunity Champion
You need to "flip" your logic. So, instead of going "bottom up" you need to go "top down"
new duration in min =
VAR next = MAXX(FILTER ('Talend_GA sessions';
'Talend_GA sessions'[session_id] = EARLIER('Talend_GA sessions'[session_id]) &&
'Talend_GA sessions'[created_timestamp] < EARLIER('Talend_GA sessions'[created_timestamp])
);'Talend_GA sessions'[created_timestamp])
RETURN (DATEDIFF(next;'Talend_GA sessions'[created_timestamp];MINUTE))