How to combine graphql results and get monthly and weekly sales data

Hi, we are looking for a way to execute the same shopifyQl query that fetches monthly sales totals in the newer graphql api.

We have something like this that returns monthly sales figures:

  {
    shopifyqlQuery(query: "FROM orders SHOW sum(gross_sales) AS monthly_gross_sales GROUP BY month SINCE '2024-11-01' UNTIL '2024-11-25'") {
      __typename
      ... on TableResponse {
        tableData {
          unformattedData
          rowData
        }
      }
    }
  }

But using the newer versions of the graphql api (now that shopifyql is sunsetted), we seem to only be able to return multiple orders at a time, not grouping them.

Is there a way to do this with the newer graphql api, for example grouping these values:

{
    orders(first: 5, query: "processed_at:>=2024-11-01") {
        nodes {
            subtotalPrice
        }
    }
}

You’ll need to perform these transformations on your own.

For this use case, I highly recommend using the Bulk Operations API to retrieve the order data you need to compute from.

Then you can perform the calculations once you have downloaded and parsed the order data.

Docs: Perform bulk operations with the GraphQL Admin API

Thank you. I did start to export basic order data to Supabase in order to parse it and get the information that way, but I would prefer to use Shopify as the data source.

As this isn’t possible, I will use bulk operations to periodically export data to Supabase.