If you using Universe as the source, In UDT this can be defined at Universe level. You can limit the size of result set in Universe Parameters -> Controls
In Query panel, you have an option to set the limit on rows retrieved for each individual query. This setting is called the Max rows retrieved.
This option is linked to each individual query, not with Webi document as a whole. When your document has multiple queries, you need to set the Max rows retrieved for each of them.