I am trying to create this calculated metric using the median function in conjunction with time spent per visit, but it is not working. I get the same value all the way down the column, regardless of what date range or dimension i break it down by. I also tried using it with"total seconds spent" but got the same result. Any ideas?
Hi Shawn, can you give us some info on how you had the workspace set up? If you're able to provide enough info to where I can start with a blank workspace and work up to where I can clearly see all median values being the same, that would be the most ideal.
here is an image of how I set up the median time per visit metric. On the workspace, I tried this metric with multiple dimensions, such as last touch channel and referring domain. All of them have the same median time per visit going down the column.
OK - I figured out what is going on! The way functions work is not how I expected (and others asking this and similar questions).
Aggregate / Statistical functions are applied to the breakdown rows of data in the freeform table - as opposed to the raw data. Here is a simple example. You can see that the mean pageviews per visit column has the same value for all rows:
Pageviews per visit is defined like this:
Mean pageviews per visit is defined like this (note it includes a function):
Why does the mean function return 6.66 and why does the summary in the "Pageviews per Visits" column return 6.71?
6.66 is the average of the values in the "Pageviews per Visits" column - the average of 7 values. That is how the Adobe functions work in calculated metrics. The overall value in the "Pageviews per Visits" column is the total number of pageviews over the 7 days divided by the total number of visits over the 7 days. The math for these helps you see why they are not the same thing:
Basic functions within Adobe Analytics fall into the categories of 'Row' or 'Table', its imperative to be mindful of which type you are trying to employ.
Median is a 'Table' function.
Couple of ideas to get you close:
1.) Use a cumulative custom metric to evaluate where historically the 50% of visit break point is - then create a calculated metric for % of visits that are that value or lower. This will allow you to trend if there is a change.
2.) Use nested if formulas to achieve a bucketed version of the median metric. Something like (if visits shorter than x divided by all visits is > .5 then x) You will need a number of if statements and need to start with your lower bucket.
There are a couple of screenshots in this tweet that provide direction.