 how to get a total number of rows for a view with a filter and no pager  the flag view gettotalrows is used to force the query of the view to calculate the total number of results of the set this parameter is true by default in views that get all the results no limit or those which have a pager so you always have the view totalrows variable populated in those cases but when you have a view that gets only a given number of results and no pager the count query is not executed by default so you have to force it ie in the hookviewspreexecute so you have view totalrows populated for later use this code will help you do that php function mymoduleviewspreexecute view if view name myview view currentdisplay mydisplay view gettotalrows true  