When using RowNo to count the number of rows on a Pivot Table, it doesn't seem to work because the count starts again somewhere in the middle of the table (see below),
The issue occurs because RowNo() returns the number of the current row within the current column segment in a table, that is the count starts again from 1 each time the value of the first dimension changes.
Resolution:
To get the desired result we have to use the TOTAL qualifier in the RowNo() function as shown below.