# Calculate the percentage based on two calculations - one for future data and another for past data and finally create a bar chart for every team

**URL:** <https://discuss.elastic.co/t/calculate-the-percentage-based-on-two-calculations-one-for-future-data-and-another-for-past-data-and-finally-create-a-bar-chart-for-every-team/261429>\
**Category:** Kibana\
**Created:** [January 18, 2021, 12:59pm UTC](https://discuss.elastic.co/t/calculate-the-percentage-based-on-two-calculations-one-for-future-data-and-another-for-past-data-and-finally-create-a-bar-chart-for-every-team/261429 "2021-01-18T12:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![preeti1211](https://avatars.discourse-cdn.com/v4/letter/p/b782af/32.png) [@preeti1211](https://discuss.elastic.co/u/preeti1211)\
**Post date:** [January 18, 2021, 12:59pm UTC](https://discuss.elastic.co/t/calculate-the-percentage-based-on-two-calculations-one-for-future-data-and-another-for-past-data-and-finally-create-a-bar-chart-for-every-team/261429/1 "2021-01-18T12:59:36Z")

</div>

Calculation -  
95/120 (First value being the number of PBIs approved for future 3 sprints and second value being the number of PBIs completed in the past 3 sprints). If the divided value is =\<33% the bar chart should be red. If it is =\<66% bar chart should be amber. If it is \>66% to 100% it should be green.  
Product Level Visualization: Barchart showing percentage for each of Team with bar showing as GREEN / AMBER / RED based on the same logic above

Use case is to have a bar chart with x axis as team name and y axis as percentage calculated for each time and bar chart for each team will be of corresponding color based on calculated percentage.

Can you please help which visualization and how we can achieve this usecase

Thanks  
Preeti

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [January 20, 2021, 7:18pm UTC](https://discuss.elastic.co/t/calculate-the-percentage-based-on-two-calculations-one-for-future-data-and-another-for-past-data-and-finally-create-a-bar-chart-for-every-team/261429/2 "2021-01-20T19:18:03Z")

</div>

You didn't describe anything about how your data is stored, which is usually an important factor, but in this case you have only one option: use Vega to build a fully custom query + vis. Here's a tutorial showing how to query data, which is the starting point you should use: [https://www.elastic.co/guide/en/kibana/current/vega-lite-tutorial-create-your-first-visualizations.html](https://www.elastic.co/guide/en/kibana/current/vega-lite-tutorial-create-your-first-visualizations.html)

---

<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:** [February 17, 2021, 7:18pm UTC](https://discuss.elastic.co/t/calculate-the-percentage-based-on-two-calculations-one-for-future-data-and-another-for-past-data-and-finally-create-a-bar-chart-for-every-team/261429/3 "2021-02-17T19:18:08Z")

</div>

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