add query support for new analysis types percentile and median

I tried to mimic the test coverage you already had