# Average value (annotation line) in stacked-bar chart

**URL:** https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295
**Category:** Get Help
**Created:** [October 14, 2023, 6:46pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295 "2023-10-14T18:46:52Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 14, 2023, 6:46pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/1 "2023-10-14T18:46:52Z")

</div>

Hi! How do I output the average value (line)?

The average should be something like this:

 ![10343_chrome_MQxFZ6Xs](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/6/63edbef4731ea91a9c763d54944c084087b8fb89.png)

AVG([Expenses]) doesn’t work the way I want.

 ![10342_chrome_VMx4CvNm](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/7/747e3c6a014f7be4adba90f69f79968afdeba649.png)

The X-axis is Date.

Thank you very much!

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 21, 2023, 11:08am UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/2 "2023-10-21T11:08:09Z")

</div>

Maybe there’s an example or something similar?

---

<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: [October 21, 2023, 5:46pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/3 "2023-10-21T17:46:54Z")

</div>

The colour coding seems to show that there are actually a lot of small values (stacked on top of each other) so I suppose that the average is correctly calculated for these values, as separated into categories.  
Can you check the behaviour with the colour grouping turned off.

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 23, 2023, 4:03pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/4 "2023-10-23T16:03:21Z")

</div>

Thank you for the reply! Unfortunately, nothing has changed

 ![07730_chrome_MdsJh](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/45df620aa875bd83f20d03642d42e6cc110b6947.jpeg)

---

<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: [October 23, 2023, 4:37pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/5 "2023-10-23T16:37:18Z")

</div>

It still looks like the bars are segmented. What is the configuration of the y-axis?

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 23, 2023, 6:11pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/6 "2023-10-23T18:11:45Z")

</div>

@Chr1sG

 ![10364_chrome_DKheEwx2](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/e448c275bd527dd294f0bed5abdea4448dc22644.png)

---

<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: [October 23, 2023, 6:25pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/7 "2023-10-23T18:25:24Z")

</div>

So it looks like you are plotting the value of Cymma for each entity, but then stacking them where they share the same Date (based on the date grouping of the x-axis). So the average will be the average value of Cymma for all entities, not the average value of the sum of Cymma for each date period.

What does it look like if you set the y-aggregation to ‘`Sum`’ and then set the Annotation line as `AVG(SUM([Cymma]))`  
?

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 23, 2023, 7:16pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/8 "2023-10-23T19:16:12Z")

</div>

@Chr1sG

I think that’s what I need - solution:

 ![10377_chrome_hwFM88V9](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/0/04885ca910d65d75562ae88cb3a98ade691630b7.png)

but the chart type is not stacked-bar, unfortunately

---

<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: [October 23, 2023, 9:12pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/9 "2023-10-23T21:12:45Z")

</div>

Out of curiosity, what happens if you add the colouring by category back in?

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 24, 2023, 2:30pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/10 "2023-10-24T14:30:41Z")

</div>

@Chr1sG

sadly:

 ![07735_chrome_7sxXX](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/402eb6e51224dbeffa3d8f319ef5758e47ae6996.jpeg)

---

<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: [October 24, 2023, 2:43pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/11 "2023-10-24T14:43:00Z")

</div>

Yeah, kinda what I expected, Just wanted to check.  
Does the y-axis config allow you to define the annotation line as `AVG(SUM([Cymma]))` ?

---

<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: [October 24, 2023, 2:43pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/12 "2023-10-24T14:43:51Z")

</div>

Also, what does it look like if you choose side-by-side bars instead of stacked?

---

<div class="post-metadata">

### Author: ![Mikhail](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mikhail/32/7493_2.png) [@Mikhail](https://community.fibery.io/u/Mikhail)
#### Post date: [October 24, 2023, 3:07pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/13 "2023-10-24T15:07:16Z")

</div>

> [@Chr1sG](#):
>
> Does the y-axis config allow you to define the annotation line as `AVG(SUM([Cymma]))` ?

No: Cannot use aggregation inside aggregation

> [@Chr1sG](#):
>
> side-by-side bars

I can’t find that option…

Like this?

 ![07736_chrome_eTW6T](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/7/78c46b4d431cc5f43622abacaab89fef170bbe1f.jpeg)

---

<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: [October 24, 2023, 3:52pm UTC](https://community.fibery.io/t/average-value-annotation-line-in-stacked-bar-chart/5295/14 "2023-10-24T15:52:41Z")

</div>

> [@Mikhail](#):
>
> No: Cannot use aggregation inside aggregation

Yeah, I feared that would be the case ☹

> [@Mikhail](#):
>
> Like this?

Yeah, that’s what I meant. I can see it’s rather ugly though. Might look better with fewer x-axis groups, but I’m afraid the choices you have seem to be either side-by-side, or no categorisation.
