# Pie chart block - Defining what is the "100%" of my variable

**URL:** <https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585>\
**Category:** Help\
**Tags:** dashboard\
**Created:** [January 29, 2020, 11:31am UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585 "2020-01-29T11:31:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelvin\_Andrade1](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kelvin\_Andrade1](https://forums.losant.com/u/Kelvin_Andrade1)\
**Post date:** [January 29, 2020, 11:31am UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/1 "2020-01-29T11:31:53Z")

</div>

Hello!

I’m having some trouble with [Pie Chart](https://docs.losant.com/dashboards/pie-chart/) when trying to show the number of devices in “alarm” state.

I’ve inserted two variables that are counted using Systems:

- Number of devices in alarm state
- Total number of devices

My problem is that the percentage is not showing as I want. It is summing the total number of both variables to define what is 100%.

As example, if the number of “devices in alarm state” is equal to “total number of devices”, the Pie chart shows half filled part when what I would like to show is a 100% filled.

It is possible to inform to Pie Chart block what is the total amount of my variable that it will correspond to 100%?

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [January 29, 2020, 3:18pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/4 "2020-01-29T15:18:02Z")

</div>

@Kelvin_Andrade1,

Yes, this is possible. To do this, you’ll need two attributes:

- Number of devices in an alarm state
- Number of devices **NOT** in an alarm state

Those are the two attributes that would be displayed in the Pie Chart.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/c/c7042a9073552958748233f8381788db9803005d.png)

I’m happy to elaborate more or answer more questions 🙂

---

<div class="post-metadata">

**Author:** ![Kelvin\_Andrade1](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kelvin\_Andrade1](https://forums.losant.com/u/Kelvin_Andrade1)\
**Post date:** [January 29, 2020, 4:29pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/6 "2020-01-29T16:29:06Z")

</div>

Nice! Thanks

But is there a way to count devices without alarm state in a System?

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [January 29, 2020, 4:29pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/9 "2020-01-29T16:29:53Z")

</div>

@Kelvin_Andrade1,

How are you currently calculating the number of devices in an alarm state ?

---

<div class="post-metadata">

**Author:** ![Kelvin\_Andrade1](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kelvin\_Andrade1](https://forums.losant.com/u/Kelvin_Andrade1)\
**Post date:** [January 29, 2020, 4:37pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/10 "2020-01-29T16:37:30Z")

</div>

I’m doing “by hand” in a workflow. I’ve created an attribute to indicate that device is in alarm. This is setted by the same condition used to generate my Events.

This attribute can be just “1” or “0”. So, i’m summing this attribute from all devices that are below my System.

---

<div class="post-metadata">

**Author:** ![anaptfox](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/anaptfox/32/873_2.png) [@anaptfox](https://forums.losant.com/u/anaptfox)\
**Post date:** [January 29, 2020, 4:40pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/13 "2020-01-29T16:40:43Z")

</div>

@Kelvin_Andrade1,

Nice. In this workflow, where you’re setting the alarm attribute. I’d also set a `notAlarm` attribute. Whenever you update `alarm` you can just set `notAlarm` to the opposite.

We do have a current ticket out to make stuff like this easier using the Pie Chart. I’ll add this request to that ticket.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Andrade1](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kelvin\_Andrade1](https://forums.losant.com/u/Kelvin_Andrade1)\
**Post date:** [January 29, 2020, 5:08pm UTC](https://forums.losant.com/t/pie-chart-block-defining-what-is-the-100-of-my-variable/2585/14 "2020-01-29T17:08:06Z")

</div>

Yeah, I think this is the way! I was just wondering if there wasn’t another way to do it.

Nice, it will be a great feature! If Systems could recognize the Event state associated to devices it will let things easy!

Thanks for your attention!
