I have a dataset that shows the logins by date and unique_session_code for each user that visits the webpage of a bakery. I am trying to come a code that allows me to determine if this is the first, second, third and so on... visit of this customer in other words the "nth_visit"
USER | LOG_DATE | TX_REV |
ALEX | 30/04/2021 | uyjd |
MARY | 30/04/2021 | dn89 |
DOLLY | 30/04/2021 | nqmd0 |
FRANK | 29/04/2021 | nsj456 |
MARY | 29/04/2021 | zlpa2 |
DOLLY | 29/04/2021 | s09dm |
ALEX | 28/04/2021 | jds02 |
MARY | 28/04/2021 | kqos98 |
DOLLY | 28/04/2021 | uiskk0 |
|This would be my desired result:
USER | LOG_DATE | TX_REV | nth_visit |
ALEX | 44314 | jds02 | 1 |
ALEX | 44316 | uyjd | 2 |
DOLLY | 44314 | uiskk0 | 1 |
DOLLY | 44315 | s09dm | 2 |
DOLLY | 44316 | nqmd0 | 3 |
FRANK | 44315 | nsj456 | 1 |
MARY | 44314 | kqos98 | 1 |
MARY | 44315 | zlpa2 | 2 |
MARY | 44316 | dn89 | 3 |
A table has the "nth_visit" to the website by each attempt of the visitor
Thank you so much guys
| streamstats count as nth_visit by USER
Ok thanks so much for this... I didn't know about streamstats is that the command for whenever we wanna know the nth position solely? I thought we only had stats thank you so much
streamstats can be used for more than just finding the nth position.