Per the documentation this should work
<expression>sizeof(<unit relativeTo="ca_entities" delimiter=",">^ca_entities.entity_id</unit>)</expression>
And it does work, most of the time. However when I have over like 2000 related records, it doesn't show anything.
For a display template, is there another way to show the count of related records?