How to use Aggregating function in Logseq query

I collect articles as reference links (“Links”) and assign them to Topics (“Topics”). I need to calculate how many links each topic has collected as an indicator which topic is the priority to work on (the one with the most reference links). Currently the Links’s property include "Type:: Link , Topic:: Topic 1, Topic 2 " ; a topic’s property include “Type:: topic ; "
I guess I can use Sum or Max function but I have no experience in using them. Maybe I can add a property like " Reference-count:1 " so the query can count the value ('1”) if so whats the full query look like ? Thank you!

1 Like