# Help with query to count two sets of records and work out percentage between them

**URL:** <https://discuss.elastic.co/t/help-with-query-to-count-two-sets-of-records-and-work-out-percentage-between-them/84851>\
**Category:** Elasticsearch\
**Created:** [May 7, 2017, 2:03pm UTC](https://discuss.elastic.co/t/help-with-query-to-count-two-sets-of-records-and-work-out-percentage-between-them/84851 "2017-05-07T14:03:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitsprint](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bitsprint/32/18010_2.png) [@bitsprint](https://discuss.elastic.co/u/bitsprint)\
**Post date:** [May 7, 2017, 2:03pm UTC](https://discuss.elastic.co/t/help-with-query-to-count-two-sets-of-records-and-work-out-percentage-between-them/84851/1 "2017-05-07T14:03:49Z")

</div>

Hi,

I need help with a query that gets records from an audit index where the message starts with PaymentAccepted or PaymentRejected.

I need to count both and determine the percentage of rejected payments.

Can anybody advise?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 4, 2017, 2:04pm UTC](https://discuss.elastic.co/t/help-with-query-to-count-two-sets-of-records-and-work-out-percentage-between-them/84851/2 "2017-06-04T14:04:03Z")

</div>

Closed on June 4, 2017, 2:04pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
