Count the number of True items in a table column

Hello fellow coders. I have this table where the source is dynamically changed between multiple (5 different) queries of same output schema. In particular, one of the columns of the table contains booleans.

I would like to find an elegant way of counting how many True values we have in that column, and to display it on screen for example in a Text or Number component.

I understand I could effectively run a second query for each of the potential sources, where I do a count instead of pulling the full data. But that means creating another 5 queries, run them, select the right one based on which one is currently selected as datasource for the table, and so on. It would work, but that's very much duct tape and chewing gum.

A more elegant solution would be to do the thing only once, directly on the point of convergence which is the table itself, and the data it currently contains. But let's face it, the table documentation is rather sparse, so I am a bit lost.

Any pointers on how to go about it?


Use a Query with JSON on the table data
select count(*) from {{}} where yourcolumnnamefromdata = true