get result count of a view in another I have 2 views. One view is displayed in the header of other view. Both views has its own block template. I need to get the sum of both views result count to display a no result message if sum is equal to zero. Is there any way to do it.
Add a NO RESULTS BEHAVIOR Global: Text area to the inner view (the one in the header) and leave it empty.

Add this code to your theme's template.php file:

function THEME_views_pre_render(&amp;$view){
  if (($view-&gt;name == 'outer' &amp;&amp; $view-&gt;current_display == "default") || ($view-&gt;name == 'inner' &amp;&amp; $view-&gt;current_display == "default")) {
    static $count = 0;
    $count += $view-&gt;total_rows;
    if (count($view-&gt;parent_views) &amp;&amp; $count == 0){
      $view-&gt;empty['area']-&gt;options['content'] = "custom no result text";
    }
  }
}


Change the view names (outer and inner in my example) and display_names (default in my example) to reflect your views.

Clear the cache. 

Perhaps someone else can elaborate on how to add the global text for the no result in code instead of setting it to an empty value in the UI and then altering that value in code.

EDIT

If you intend to add any of these block multiple times on the same page then this answer will no longer be valid. Also, the no result text displays in the no result text for the inner view. You may want to consider altering the title of the block in that case. Unfortunately the outer view runs first, so it cannot be added to there as the result count of the second view is not yet available at that stage. count($view->parent_views) is the bit of logic that checks for the inner view.You can change that to check for the $view->name if you want to.