## Days since last visit as a calculated metric

mubarakd5726232

Total Posts

89

Likes

84

3

mubarakd5726232

Total Posts

89

Likes

84

3
mubarakd5726232

25-11-2020

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 ?

#### Accepted Solutions (0)

yuhuisg

MVP

Total Posts

420

Likes

131

86

yuhuisg

MVP

Total Posts

420

Likes

131

86
yuhuisg
MVP

25-11-2020

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).

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.