Do an aggregation of countId. This would give you the total number of rows.
Create a second model that is a regular model with the same conditions as the aggregate sorted in ascending order for the value you need the median for. This will load the individual rows in. You could then have a UI only formula field that references the value of the nth row in the regular model based on the countId of the agg model divided by 2 rounded to the nearest whole number minus 1 since the first row is row 0.