Thanks for two interesting answers
To get a better understanding, I tried it in practice. See screenshot below.
It seems that swuehls "Don't Count(Keyfield)" is a good recommendation, because the answer I got didn't make much sense to me. The same goes for Sum(Keyfield), and I assume other aggregation functions.
Using the distinct keyword, the functions seem to count or sum the distinct keyfield values from both tables, combined. So, without the distinct keyword, I would have expected to get the result that Juan suggested, but I got the same results as with the distinct keyword. Which is what doesn't make any sense to me, and which is why I guess I'll stick to swuehls recommendation going forward.
Trying to be constructive: To count the keyfield from table A, I added a new column (Col2) with nonsense values, and stuck a condition to ignore nulls in Col2 into the expression. I guess there is some kind of outer join going on, because this did give the expected result, 4.
If anyone knows of any 'official' documentation about what is going on, it'd be interesting to see.
Have a look at Henric's blog post:
As you already did, a common way to count the records of a key field in a specific table is to count another field in that table, that shows a value for every key field value.
With regard to the results when counting a key field: The results are non deterministic, e.g. might depend on the load order of your tables.