Sorting Collections by data that’s calculated client-side?

On the front-end I’m using a template helper to
return (and display) the % change between two time periods. For example,
I pass in D0 and D30 and it returns -25%. I can access this data within my template.

But I can’t for the life of me figure out access it – and use it –
outside of the template. My use case: I have a list of Country documents
that I’d like to sort by this computed value.

What’s the best approach here – and, in general, for interacting w/
data that’s calculated client-side? My first thought was to just move
this calculation / data into my Collection and then sort it on the
pub/sub wire but I’ve read elsewhere I should avoid polluting my
Collections with data that can be calculated client-side… Alas, I’m
confused.

You can use your data outside of your template by using reactive variable, read this article by @themeteorchef for better understanding of it.

I hope this helps.

Also consider taking a look at the Client-side data with reactive stores section of the Guide.