# count number rows of an AND formula

Resolved asked on September 28, 2020

Wanting to know if it’s possible to calculate boolean function within row for calculated value

For example:
With CSV columns: A, B, C, D, E
Value of each column is 0 or 1 indicating false or true
how can i count number of rows where  value of A and D are both 1?

Thank you

Public September 30, 2020

Hi Michael,

Thank you for posting your question.

The described functionality can be achieved using built-in Flexmonster calculated values.

More specifically, you can define a separate measure similar to the following:

`{    "uniqueName": "Formula #1",    "formula": "if(\"A\" == \"D\" and \"A\" == 1, 1, 0)",    "individual": true,    "caption": "Formula #1"}`

The measure’s `formula` counts the row towards the final result if A & D field values are equal between each other and are equal to 1.

Furthermore, the `individual` property is set to `true` to ensure that raw values are used to calculate the measure value, instead of aggregated values – this allows the measure total to be calculated in a proper way, instead of comparing the totals of A & D columns.

To demonstrate the approach described above, we’ve prepared a quick JSFiddle sample – feel free to check it out: https://jsfiddle.net/flexmonster/8y52ax3r/

Please let us know if this helps.

Best regards,
Mykhailo

Public October 7, 2020

Hi Michael,

Hope you’re doing well.

We were wondering if you’ve received our response with suggestions regarding calculated values. Was it helpful, or is there still anything we can help you with?

Please let us know what you think.

Regards,
Mykhailo

Public October 14, 2020

Hi Michael,

How are you?

Just checking in to ask whether you’ve found our previous suggestions helpful.

We would be happy to hear your feedback!

Kind regards,
Mykhailo

Public October 14, 2020

thank you for your answer. for more complicated boolean logic, are we able to use brackets to help group operators?
e.g.

`"formula": "if((\"A\" == \"D\" and \"A\" == 1) or \"B\", 1, 0)"`
Public October 15, 2020

Hi Michael,