Median and p50 values differ

Hello,

I was creating a web performance dashboard using median and percentile functions. However, I have noticed that median and p50 don’t have the same value. They differ a little bit, however, theoretically, they should be the same.

Here 2 queries I was using:

SELECT FILTER(percentile(largestContentfulPaint, 50), where(timingName = 'largestContentfulPaint')) as 'Largest Contentful Paint' FROM PageViewTiming WHERE pageUrl LIKE '%/register/%' AND deviceType = 'Desktop' SINCE 1 week ago
with the result 2.844s

and

SELECT median(largestContentfulPaint) FROM PageViewTiming WHERE pageUrl LIKE '%/register/%' AND deviceType ='Desktop' SINCE 1 week ago
with the result 2.868s

What could be the reason for different values?

Thank you in advance!

In the percentile query you are using a filter. Maybe try running the both at the same time with the same approach.

Select percentile(largestContentfulPaint, 50), median(largestContentfulPaint) FROM PageViewTiming WHERE pageUrl LIKE '%/register/%' AND deviceType ='Desktop' AND timingName = 'largestContentfulPaint' SINCE 1 week ago

Hello,

Right, sorry I missed it. When I used the query you provided it returned almost identical results (3.219 and 3.218). Thank you!

1 Like

Great to hear that worked out for you @jevgenijazigisova! Thanks @6MM for sharing!