This members-only tutorial provides the steps to define a custom function that returns the number of items of the given Custom Post Type other than the current one when any singular page of the CPT is being viewed that belong to the same taxonomy term(s) as the current item.
This can then be used, for example, with Oxygen's Dynamic Data > PHP Function Return value feature to ensure that a Section having a Repeater for showing "related" CPT items gets output only if there is at least one matching post.