This one is for googlers
[:find ?tag ?n
:where
[(datomic.api/q (quote [:find ?e (count ?post) :where [?post :post/tag ?e]]) $) [[?tag ?n]]]
[(> ?n 3)]]
RICH: You can do this and similar (SQL ‘HAVING’-like) things by chaining together queries, i.e. use the result of an aggregating query as the argument to a further narrowing query. source