Divide aggregate sums by further edge

Hi @Awoogamuffin,

Welcome to Dgraph Community !!

Did you try using groupby to aggregate queries ?

I am able to get total payments by country and paymentType using the following query:

{
  getPaymentByCardAndCountry(func: has(locationName)) {
    locationName
    ~location @groupby(paymentType) {
    	payment as sum(amount)
    }
  	val(payment)
  } 
}

Although, with the limitation that groupby block cannot contain anything other than aggregation variables, the result is not completely same as expected. I do believe however that this does solve your problem up to certain extent.

Do let us know if this solves your problem.

1 Like