How to get number of elements of associative array having 2 dimensional index?

In reply to dave_59:

Questa-sim gives me expected result, but VCS-2016.06 gives me following error,
Error-[XMRE] Cross-module reference resolution error
Error found while trying to resolve cross-module reference.
Originating package ‘$unit’.
Source info: array.num()