Order Total by week
In this example we show you how to return the total number of orders by week
less than a minute
What you’ll learn
- How to return the total number of order by week for a given date range
The Query
query {
invoiceSummary(
groupBy: [{ fn: week, column: invoicePaidAt }]
sortBy: [{ direction: DESC, column: invoicePaidAt }]
where: {
invoicePaidAt: { gte: "2020-01-01", lte: "2020-12-25" }
sellerAccountType: { eq: retailer }
}
) {
invoicePaidAt
orderIdDistinctcount
}
}
The Response
{
"data": {
"invoiceSummary": [
{
"invoicePaidAt": "2020-12-21",
"orderIdDistinctcount": 19
},
{
"invoicePaidAt": "2020-12-14",
"orderIdDistinctcount": 221
},
{
"invoicePaidAt": "2020-12-07",
"orderIdDistinctcount": 142
},
{
"invoicePaidAt": "2020-11-30",
"orderIdDistinctcount": 86
},
{
"invoicePaidAt": "2020-11-23",
"orderIdDistinctcount": 96
},
{
"invoicePaidAt": "2020-11-16",
"orderIdDistinctcount": 17
},
{
"invoicePaidAt": "2020-11-09",
"orderIdDistinctcount": 6
},
{
"invoicePaidAt": "2020-11-02",
"orderIdDistinctcount": 0
}
]
}
}