Allow to process totals
Allow the charts to do calculations on the totals, say we fields: [currentAmount, renewedAmount]
And the chart shows as totals [1000, 800]
Then it should allow to show it as .80 (or 80% with formatting), at least in a Text, Number Chart.
Keep in mind, since so far what I've researched we can only do calculations on each field then it would not be possible to add ratios per document.
![](https://secure.gravatar.com/avatar/49c89b20e582bd742c9c8cbe8138ad5c?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
AdminTom (Product Manager, MongoDB) commented
Thanks for the suggestion Gabriel.
Just to make sure I understand the request: currently it is possible to add calculated fields (which can be used for things like ratios), however these fields are calculated per-document. So I think you want something like calculated fields that apply to the encoded/grouped values, for example on the total values from all documents?
That's a fair feature request. If you need this now there is a workaround which is to pre-group the data in a pipeline, e;g:
[ { $group: {
_id: {}, totalCurrent: { $sum: '$currentAmount' },
totalRenewed: { $sum: '$renewedAmount' }
}]...and then you can calculate the ratio using a calculated field, or a separate $set stage in the pipeline.