Tree table subtotals wrong

I’m using a richselect view to filter values of tree table. The lower level values are populating correctly, but the sums at level 1 are not changing based on selection. Please advise.

Hi, @tnad0073 !
You can calculate subtotals in a template with eachSubItem function:

template:function(obj, common) {
  if (obj.$group) {
    if (obj.$count) {  //has child items
      let sum = 0;
      $$('tree1').data.eachSubItem(, function (child) {
        if (child.spend) sum += child.spend;
      return sum;
  return obj.spend;

Please, check the snippet: Code Snippet