# 100% Stacked bar/area chart

**URL:** <https://community.fibery.io/t/100-stacked-bar-area-chart/4454>\
**Category:** Get Help\
**Created:** [May 16, 2023, 11:23am UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454 "2023-05-16T11:23:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [May 16, 2023, 11:23am UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/1 "2023-05-16T11:23:13Z")

</div>

I’m trying to achieve a 100% stacked bar (or area) chart.

Below is what I have so far _vs_ what I want to achieve (quick sketch).

 ![stacked_bar_chart](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/0843e2e3a7a7278b913d96be01fab7786151eb9c.png)  
 ![stacked_bar_chart_100](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/2/201e68d69d386bda15a7467ec29122e9f2546bb5.png)

The purpose is to get a better visual representation of how the bars have changed over time.

You could say the Pie chart achieves what I want (percentages of a whole) but I cannot get the visual comparison side by side. With multiple pies you can get the comparison over time but not as cleanly as this.

Any ideas on how to achieve 100% stacked bar chart?

---

<div class="post-metadata">

**Author:** ![billyjackson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/billyjackson/32/6345_2.png) [@billyjackson](https://community.fibery.io/u/billyjackson)\
**Post date:** [May 16, 2023, 11:42am UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/2 "2023-05-16T11:42:23Z")

</div>

> [@aoe](#):
>
> You could say the Pie chart achieves what I want (percentages of a whole) but I cannot get the visual comparison side by side. With multiple pies you can get the comparison over time but not as cleanly as this.

Would a formula work that normalizes the amounts to percent of total, either at the database or the report level?  
Percent of Color = ColorValue/SUM(ColorValues) for each quarter?

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [May 16, 2023, 11:47am UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/3 "2023-05-16T11:47:29Z")

</div>

That was actually my first idea but I kept getting division by zero errors so I stopped trying after a while 🙂

I first tried getting the ratio by doing this, but same error, division by zero.  
Any ideas where I’m going wrong?

```auto
ABS(
	SUM([Amount])
) / RUNNING_MAX(
	ABS(
		SUM([Amount])
	)
)

```

I’ll try to look at doing it your way as well by normalizing each bar instead of trying to normalize for the maximum of the bars.

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [May 16, 2023, 1:41pm UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/4 "2023-05-16T13:41:33Z")

</div>

**Some progress:**

I can get it normalized if I only have it active on one quarter/bar.

 ![stacked_bar_chart_100_total_one](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/d/d50686cdfad49210339f5572440595d39b7a2e2a.png)

But if I add more it falls apart 😃

 ![stacked_bar_chart_100_total](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/d/dd4e5e7ac269af75012a7944fe82d229bdc6438c.png)

And it’s not really strange since it’s calculating with the total of **all** bars. So it’s correct across all bars (they add up to 1) but not on each individual bar (which is what I want).

I’m looking for a way to divide by the total of each bar, not all bars.

If anyone can see anything obvious I’m missing, please let me know, it would be much appreciated! 🙏

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 16, 2023, 1:55pm UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/5 "2023-05-16T13:55:47Z")

</div>

Would you be willing to share the relevant space (as a template) and we might be able to help you.  
If you don’t want to share publicly, ping us in the chat, and you can provide it to us in a dm

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [May 16, 2023, 2:25pm UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/6 "2023-05-16T14:25:11Z")

</div>

Thanks for the offer @Chr1sG!

I went ahead and created a test space demonstrating the problem I have.

> **[100StackedBarChart — Fibery](https://shared.fibery.io/sign-up?appShareId=85e7b011-f20b-4e45-8406-b497e4490c99-100stackedbarchart)**
>
> Create a Fibery account to replace isolated tools and bring everyone together.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 16, 2023, 3:28pm UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/7 "2023-05-16T15:28:27Z")

</div>

I think the only way to solve this is to make a couple of helper fields in the financial rows database, which allows each entry to ‘know’ the total value of all entries in that month.  
Then you can just divide by this amount in the reports.

> **[100StackedBarChart — Fibery](https://shared.fibery.io/sign-up?appShareId=e84e3a1f-1831-449d-9196-e743a5170763-100stackedbarchart)**
>
> Create a Fibery account to replace isolated tools and bring everyone together.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/0cf3368d154836e3229f3cb1928a8bcf05f99c53.png)

---

<div class="post-metadata">

**Author:** ![aoe](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/aoe/32/6018_2.png) [@aoe](https://community.fibery.io/u/aoe)\
**Post date:** [May 16, 2023, 7:37pm UTC](https://community.fibery.io/t/100-stacked-bar-area-chart/4454/8 "2023-05-16T19:37:31Z")

</div>

Alright, thanks for checking!
