How to count booleans?

Highlighted
New Contributor

How to count booleans?

Hi - I am trying to create a graph where it displays the number of items selected by the user. These items are marked through booleans. Is there a way where I can count how many items are selected per category using the booleans?

 

Thanks!

6 REPLIES 6
Highlighted
Master Anaplanner/Community Boss

Re: How to count booleans?

Hi!

 

Yes, pretty simple, create another line item called Active Categories formatted by Number and use this formula:

IF Boolean = TRUE THEN 1 ELSE 0

 

Then use this Active Categories to create your graph

 

If this is a little confusing, could you please share some screenshots and I can help more!

 

Regards,

Anirudh

Highlighted
Certified Master Anaplanner

Re: How to count booleans?

Hi!

 

The simplest way will be below.

 

New Item = if boolean then 1 else 0

And sum this item.

 

I am afraid that you feel some dissatisfaction with doubling cell counts to get one mere aggregation number.
But if I were you, I would do this. A tricky way is sometimes not well understood by others.

 

I hope this helps,
Taichi

Highlighted
Master Anaplanner/Community Boss

Re: How to count booleans?

@CommunityMember131289 

@anirudh and @Amaya are correct.

If you specifically want a category count you can create the line item as @anirudh and @Amaya suggest and also create a system module that allows you to filter on categories so you can get the total count for categories. 

 

Just for thoroughness,

There's a question posed by @anupkumar.gade earlier about how to use the YEARVALUE function on Booleans

If your use case only requires you to know if ANY Booleans are checked you can use this little trick to to refer to the Year value of the Booleans. It won't give you a count but it will give you a TRUE / FALSE on the category.


Jared Dolich
Highlighted
Frequent Contributor

Re: How to count booleans?

Hi,

 

As mentioned by others, you can simply create 2 line items:

1 Bool - Where user will select the product

2 Num - Formula : IF Bool THEN 1 ELSE 0

 

Yash1_0-1581307884366.png

 

Hope this helps.

 

Thanks,

Yash

Highlighted
Occasional Contributor

Re: How to count booleans?

Hi,

 

Create a new line item in the module. 

Write the below condition.

IF boolean = true then 1 else 0 

The summary line item should give you the number of booleans in the Boolean line item. 

 

Thanks

 

Neel

Neelkanth Oruganti
Highlighted
Contributor

Re: How to count booleans?

Hi

Create a new line item in your module.

Below condition, we can apply

IF boolean = true then 1 else 0 

 

 

Thanks

 

Parmod