Sum values from extended subgraph

Hi all,

We are using one gateway with 10 federating subgraphs. Pleased with the way all works until now.

However, I’ve come across a challenge which I am not sure how to solve.

We have bundle subgraph that returns bundle details and bundle items, each item in the bundle items holds productId and can resolve product subgraph by that id.

bundles(productId: 38847) {
    id
    name
    description
    discount
    condition
    *totalPrice* <--- this field should be sum of all item prices minus the discount
    items { <--- returns array of items
      isLeader
      productId
      *product* { <--- product subgraph
        price
        name 
      } 
    }
  }

I want to have totalPrice field inside bundles that will be a sum of all bundle item prices that are coming from product subgraph minus the discount that sits on bundles subgraph itself.

I had a look at computed fields Entities in Apollo Federation - Apollo GraphQL Docs. But this seems to be only possible for a field, can’t find a way nor an example how would I sum all the prices that are coming from different subgraph then extract the discount from that value.

Is there a way to do this?