How does Median Function works in Adobe Analytics as results I am getting are same to Mean.
Views
Replies
Total Likes
I think the median represents the middle value in a series of numbers. However, when we look at “average time spent,” it is derived from the series of time differences between hits. The “average time on site” itself is not a series or sequence of numbers. it’s already a single aggregated value.
Therefore, if you attempt to calculate the median of a mean, the result will always be the same as the mean.
Example:
Average Time Spent (Mean) = 500 sec
Average Time Spent (Median) = 500 sec
This is because calculating the median of a single value (500) simply returns that value itself and this is how adobe is also calculating the values.
In Adobe Analytics, the Median function is based on the series of data in your table... it will tell you the median value based on all the rows shown.
When you only have 1 row, it will match the value.
Let's use some simple examples:
Starting with a single row table
| Orders | Mean Orders | Median Orders | ||
| Month | 793 | 793 | 793 | |
| November | 793 | 793 | 793 |
There is only one row to "average" (or mean), and only one row to pull out the median... so all the values will match.
Now, let's look at something with multiple rows
| Orders | Mean Orders | Median Orders | ||
| Day | 793 | 198 | 197 | |
| Nov 27 | 192 | 198 | 197 | |
| Nov 28 | 211 | 198 | 197 | |
| Nov 29 | 201 | 198 | 197 | |
| Nov 30 | 189 | 198 | 197 |
Now, there are rows to calculate, you can see that the mean takes each of the values (192, 211, 201, 189) and rounds the value. The median, takes the values in order (189, 192, 201, 211), and either finds the value that sits right in the middle (if an odd number of rows), or takes the average of the middle two values (if an even number of rows).
Functions like Mean and Average are all row based functions...
You could break Nov 21 down by hour, and get the median time spent across all hours of the day... but I don't think that's what you are looking for...
If you really want a median time spent, you will have to take this outside of Adobe, where you can calculate each time spent by each user, and calculate a median from there...
With the majority of the functions in calculated metrics, it does the calculation based on the values in the rows. The functions use the dimension item in your table as a part of the calculation, so having only one row will give you the same result for mean and median.
If you want to understand more about the different functions, check out my guide on functions. It explains all 78 of the functions that are available in the metric builder. https://experienceleague.adobe.com/en/perspectives/calculated-metrics-playbook-your-one-stop-shop-fo...