# Sum of values from Nested field as per the Global filter for Currency unit in Bar chart

**URL:** <https://discuss.elastic.co/t/sum-of-values-from-nested-field-as-per-the-global-filter-for-currency-unit-in-bar-chart/299892>\
**Category:** Elasticsearch\
**Tags:** kql-kibana-query-language\
**Created:** [March 16, 2022, 6:39pm UTC](https://discuss.elastic.co/t/sum-of-values-from-nested-field-as-per-the-global-filter-for-currency-unit-in-bar-chart/299892 "2022-03-16T18:39:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kirubanandhan](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@Kirubanandhan](https://discuss.elastic.co/u/Kirubanandhan)\
**Post date:** [March 16, 2022, 6:39pm UTC](https://discuss.elastic.co/t/sum-of-values-from-nested-field-as-per-the-global-filter-for-currency-unit-in-bar-chart/299892/1 "2022-03-16T18:39:35Z")

</div>

I have different types of currency values in each record as per user selects the Currency\_unit, Bar chart should make sum of Currency\_value. How to acheive this. PFB for the result. If the index data type needs to me modified, please let me know. The outcome should be like if user selects the currency unit as "USD" in control filter USD values should be sum up in Bar chart similarly for EUR.

```auto
"hits" : [
      {
        "_index" : "test-currency",
        "_id" : "c4_uk38BnMsXXgDPcQEY",
        "_score" : 1.0,
        "_source" : {
          "model_number" : "QVKC911",
          "calculated_currency" : {
            "EUR" : 70.2,
            "USD" : 90
          }
        }
      },
      {
        "_index" : "test-currency",
        "_id" : "uo_uk38BnMsXXgDPmAG5",
        "_score" : 1.0,
        "_source" : {
          "model_number" : "QVKC91",
          "calculated_currency" : {
            "EUR" : 170.2,
            "USD" : 190
          }
        }
      }
    ]

```

---

<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:** [April 13, 2022, 6:39pm UTC](https://discuss.elastic.co/t/sum-of-values-from-nested-field-as-per-the-global-filter-for-currency-unit-in-bar-chart/299892/2 "2022-04-13T18:39:52Z")

</div>

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