sort views comments by vote result keeping thread I want to show comments of nodes ordered by vote result (most popular comment at the top of the list).
I have installed voting API, rate and views module. Then add a yes/no voting to comments and enable threading for comments in order to let users reply each other.

I created a views to show comments in most popular order with these sort criteria:

Comment: Thread (asc)
SUM(Votes: Value)


Now the problem is that when views tries to keep thread it sort theme by post date (asc/disc) and do not see the second sort criteria.

So how can I sort comments by vote results keeping threading?

EDIT:
Main problem
Currently there is no way to tie all the children and grandchildren comments to the Main Parent (original/first ever parent). Also, need a way to separate the Main parent from all the children.
TL, DR Solution
Use the Views field view module to separate the children from main parent, and add all children as a field. That way, we are able to sort Main Parent's by Votes without affecting the children and grandchildren.
But there is no way to just show all children and grandchildren of a Main Parent CID; therefore, create a custom module to solve this problem, so we can use the view field technique.
Detailed Solution
Requirements:
Views field view, Entity API, Main PID (custom module below).

main_pid.info
name = Main PID
description = Links all children and grandchildren comments to the main parent by saving main parent cid into main_parent_pid field when comment is saved.
package = custom
core = 7.x

main_pid.module
&lt;?php

/**
 * Implements hook_comment_presave()
 */ 
function main_pid_comment_presave($comment) {
  
  $pid = $comment-&gt;pid;
  
  if ($pid &gt; 0){
  
    while ($pid &gt; 0) {
      // Implements comment_load()
      $load_comment = comment_load($pid);
  
      $pid = $load_comment-&gt;pid;
      $cid = $load_comment-&gt;cid;
      
    }
    
    $comment-&gt;field_main_pid[LANGUAGE_NONE][0]['value'] = $cid;
  
  }
  
  elseif ($pid == 0) {
    
    $comment-&gt;field_main_pid[LANGUAGE_NONE][0]['value'] = 0;
    
  }
  
}

Now in comments add a new field called Main PID with machine name of field_main_pid. You can do this programmatically or using the Drupal UI (I will leave this up to you)

Now, hide field from display


In your view:
In fields, add Comment: Rendered Comment (Thanks to Entity API)

In fields, add Comment ID


Now add a new block

Click on block, and change the display name

In fields add Depth

In fields, add Comment: Rendered Comment (Thanks to Entity API)

The style settings will allow you to indent the children with CSS.
Example:
.depth-1 { width: 480px; margin-left: 10px; }
.depth-2 { width: 470px; margin-left: 20px; }

In Filter Criteria, add Content: Main PID

Only the Main parent has PID of 0, therefore, this will show all the children only
Then add Content: Thread in Sort and Main PID in Contextual Filter
So your Children View should look like this:


Going back to the first View:
In Filter Criteria add Main PID

This time equal to 0, since we only want the main parents.
Now in Fields, add Global: View (Thanks to Views field View)

Your Original/Main View Should look like this:
Important: Add contextual filter of NID here (forgot to do that).

Lastly, In Sort Criteria, add the Votes Value (Not shown on screenshot since I did not bother to install Voting API and Rate) and remove the default Post date.