I have a database (DatosBanderas) that, among other things, has information on the composition of the local government in a set of municipalities. The issue is that there are quite a few municipalities governed by a coalition of several parties. The composition of the local government is stored in a field named "Gobierno" and is of the form "Party 1 + Party 2 + ... + Party n." Of course, it is also posible for only one party to be in the municipal government, in which case it's just "Party i." I'm trying to count the number of municipalities in which each political party governs. To that effect, I'm using
counta(DatosBanderas;"MUNICIPIO";{not(iserror(find("Party j";"Gobierno")));"true"})("MUNICIPIO" is just the name of the municipiality). I do get a numerical output, but it's an impossibly high number (total number of municipalities is 947, the formula returns 19904, and for "Party j" I was expecting 3).
Edit I've found an obvious mistake, I should use DCOUNTA() rather than COUNTA(). However, the formula still returns a wrong answer, 0. Can formulas be used on fields of the database (as I'm trying to do here)?










