I can't figure out how Splunk calculating median/perc50 either. The result is just a estimated result when there are hundreds of events from your search.
To get the exact median that wont change, I recommend using exactperc50()
Thanks !! its helpful.
Post your search; it depends.
The search is very simple...
sourcetype=A action=B tag=C AND (field1>0 OR field2>0) AND NOT field3=xyz | stats median(field4)