How to sum() in Jinja while using frappe.get_all()

In Jinja templating

This works:

{% set gl = frappe.get_all('GL Entry', filters={'is_cancelled': 0, 'party': party, 'posting_date': ['>', from_date] }, fields=['posting_date', 'voucher_type', 'voucher_no', 'count(debit) as debit', 'count(credit) as credit'], order_by='posting_date asc', group_by='voucher_no') %}

This does not

{% set gl = frappe.get_all('GL Entry', filters={'is_cancelled': 0, 'party': party, 'posting_date': ['>', from_date] }, fields=['posting_date', 'voucher_type', 'voucher_no', 'sum(debit) as debit', 'sum(credit) as credit'], order_by='posting_date asc', group_by='voucher_no') %}

Can someone help where I am going wrong?

count() and avg() works, but sum() doesnt work.