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
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
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
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
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)"
Hi Michael,
Thank you for your response.
Yes, brackets can be used in calculated measures to create formulas of higher complexity – the example you've mentioned in your response is valid as well.
We hope this helps.
Regards,
Mykhailo