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
BedrockMission!

Learn more

View all

Sign in to view all badges

Days since last visit as a calculated metric

mubarakd5726232
Level 5
Level 5

We are capturing userids in a dimension so I'd like to create a report which for each userid shows (as a column) the "days since last visit" value 

How do I create this as a calculated metric

How do I factor in instances where users have had multiple cookies and thus would have multiple values ? 

1 Reply
yuhuisg
Community Advisor
Community Advisor

If you want the "Days since Last Visit" number to be the values in each row, then you're not going to be able to do that. Which as you've probably discovered already.

One possibility is to construct a table like this:

Main dimension: user IDs

Main metric: Visits

  --> then drag the "Days since Last Visit" dimension under that "Visits" metric. Analysis Workspace automatically breaks up the single Visits metric column into multiple Visits metric columns, one for each "Day since Last Visit" value (up to a certain number of values).

Screenshot 2020-11-26 at 10.02.31 AM.png

To mitigate double-counting, you can create a metric "Approx UserIds Count", with a Calculated Metric:

APPROXIMATE COUNT DISTINCT(userId)

Then use that instead of the "Visits" metric that I had suggested.