Invoice Value by Month

In this example we show you how to return the total invoice value by month

What you’ll learn

  • How to return the total invoice value by month

The Query

query {
invoiceSummary(
		groupBy: [{ fn: month, column: invoicePaidAt }]
		sortBy: [{ direction: DESC, column: invoicePaidAt }]
		where: { 
			invoicePaidAt: { gte: "2020-01-01", lte: "2020-12-25" } 
			sellerAccountType: { eq: retailer }
			}
	) {
		invoicePaidAt
		invoiceValueSum
	}
}

The Response

{
	"data": {
		"invoiceSummary": [
			{
				"invoicePaidAt": "2020-12-01",
				"invoiceValueSum": 29017.39
			},
			{
				"invoicePaidAt": "2020-11-01",
				"invoiceValueSum": 6464.8
			},
			{
				"invoicePaidAt": "2020-10-01",
				"invoiceValueSum": 0.0
			}
		]
	}
}