The solution below counts "rows" based on the table which contains the dimension used in count(). You may need to adjust which field you use in count() depending on your data model.
A. Limit rows in pivot table:
One way is below:
In General tab set the Calculation Condition. ex: count(dim1) <= 5
Where dim1 is a dimension used in the pivot table
Also in the General tab, click the "Error Messages..." button and find "Calculation condition unfulfilled" in the list of Standard Messages
Add your Custom Message: Too many rows dude...
The message "Too many rows dude..." will now display until selected values result in count(dim1) being <= 5
B. To export all rows
One way is dynamically set the number used in the calculation condition. You can do this with an input box. Instead of hard coding a number in the calculation condition you can base the rows on the variable tied to the input box. To export all/more data the user can change the max # of rows by setting the value in the input box. You can also use a predetermined list of values or an additional condition in your calculation condition to control the max #.