Sum up views custom text field using aggregation
Yes short Answer have a look at creating a custom twig extension:

the idea would be to pass the details required  as an "exclude from display" field (or fields) to the custom global text field. Note excluded from display fields can be accessed in the "REPLACEMENT PATTERNS" section under view text.

then basically in the text field 
you would do something like:

{myCustomTwigFunctionToCalculate( add_REPLACEMENT_fields_here)} 
// or example ... 
{myCustomTwigFunctionToCalculate( entity_id, nid, uid)}


  namespace Drupal\YOURMODULE\Twig;


  class CustomTwigToCalculateTwigExtension extends \Twig_Extension {

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return 'myCustomTwigFunctionToCalculate';
  }

  /**
   * {@inheritdoc}
   */
 public function getFunctions() {
    return [
      new \Twig_SimpleFunction('myCustomTwigFunctionToCalculate', [$this, 
      'myCustomTwigFunctionToCalculate'], [
      'is_safe' =&gt; ['html'],
    ]),
  ];
 }


 public function myCustomTwigFunctionToCalculated($param1 , $param2 ) : string {
 // Do the stuff you need to to calculate prams you pass. 

  $output = '';
  $output = $param1 + $param2 + 42;
  return (string) $output;
 }

}


you will also need a service file ... see below examples. 

Links to custom twig extension for Drupal 8:

https://www.openaccess.fr/la-veille-du-web/create-twig-extension-drupal-8

https://medium.com/@thihathit/extending-custom-twig-extension-to-drupal-8-twig-extension-class-d4b99c2177ae

https://www.youtube.com/watch?v=9PeAfExNSDk