# Bug on Metric (KPI) report

**URL:** <https://community.fibery.io/t/bug-on-metric-kpi-report/7772>\
**Category:** Bugs & Issues\
**Created:** [November 12, 2024, 7:20am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772 "2024-11-12T07:20:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/jonathan1/32/10038_2.png) [@Jonathan1](https://community.fibery.io/u/Jonathan1)\
**Post date:** [November 12, 2024, 7:20am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/1 "2024-11-12T07:20:00Z")

</div>

Hello,

I tried to create a Metric (KPI) report but it seems that there is a bug with boolean fields.

If I use the following formula : COUNTIF(_[ID]_, true), it returns the total of entities on the DB on the scope of my filter, regardless of the value of this field. If I use COUNTIF(_[ID]_, false), it returns 0.

---

<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:** [November 12, 2024, 7:32am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/2 "2024-11-12T07:32:28Z")

</div>

> [@Jonathan1](#):
>
> COUNTIF(_[ID]_, true), it returns the total of entities on the DB on the scope of my filter, regardless of the value of this field. If I use COUNTIF(_[ID]_, false), it returns 0.

I’m not sure what you think the bug is. It is expected that `COUNTIF([Id],true)` will return a count of the number of entities (and `COUNTIF([Id],false)` will return zero).

What filter are you referring to?

---

<div class="post-metadata">

**Author:** ![Jonathan1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/jonathan1/32/10038_2.png) [@Jonathan1](https://community.fibery.io/u/Jonathan1)\
**Post date:** [November 12, 2024, 8:42am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/3 "2024-11-12T08:42:59Z")

</div>

Let say that I have a DB with 100 entities. This DB have a boolean field called “Bool” and for 20 of the 100 entities, the value is set to true.

On my report, if I write `COUNTIF(Bool, true)`, the result will be `100` instead of `20`. And if I write `COUNTIF(Bool, false)`, the result will be `0` instead of `80`.

In relation to the filter, I mean that I filter the source to restrict the scope, it’s just a detail, I don’t think it is relevant on my issue.

---

<div class="post-metadata">

**Author:** ![Jonathan1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/jonathan1/32/10038_2.png) [@Jonathan1](https://community.fibery.io/u/Jonathan1)\
**Post date:** [November 12, 2024, 8:51am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/4 "2024-11-12T08:51:02Z")

</div>

Example :

I have a DB with 10 entites

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

Test1 is a Checkbox field and Test2 is a Formula field that inverse the result of Test1.

The result on the Metric (KPI) report :

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/8f737ee225461cf1418d9f6616b5918826f9cebb.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:** [November 12, 2024, 10:35am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/5 "2024-11-12T10:35:55Z")

</div>

> [@Jonathan1](#):
>
> if I write `COUNTIF(Bool, true)`, the result will be `100` instead of `20`

You have misunderstood [how the `COUNTIF` function works](https://the.fibery.io/@public/User_Guide/Guide/Numeric-functions-348/anchor=COUNTIF--6b031cb5-729a-4bf3-ac20-48c5ad557844).

Try this  
`COUNTIF([Id], [Bool]=='true')`

---

<div class="post-metadata">

**Author:** ![Jonathan1](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/jonathan1/32/10038_2.png) [@Jonathan1](https://community.fibery.io/u/Jonathan1)\
**Post date:** [November 12, 2024, 10:56am UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/6 "2024-11-12T10:56:11Z")

</div>

Thanks @Chr1sG, it works.

---

<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:** [November 12, 2024, 2:57pm UTC](https://community.fibery.io/t/bug-on-metric-kpi-report/7772/7 "2024-11-12T14:57:52Z")

</div>


