How to determine which month a lineItem from the Orders GraphQL data falls into

Topic summary

A developer is attempting to recreate Shopify’s “Total Sales by Order” analytics report using the GraphQL API, specifically trying to determine how line items are grouped by month.

Core Issue:
Using the processedAt timestamp from Order data doesn’t consistently match Shopify’s native reporting. Some line items appear in different months than their order’s processedAt date would suggest (e.g., August processedAt but appearing in September reports).

Attempted Solutions:

  • Using refund timestamps for refunded line items
  • Using fulfillment updatedAt timestamps when fulfillment status is “SUCCESS”

These approaches work for specific cases but fail as a general solution.

Current Status:
The question remains unanswered—the developer is seeking additional scenarios or logic rules that determine line item month assignment in Shopify’s analytics to achieve accurate report parity.

Summarized with AI on October 27. AI used: claude-sonnet-4-5-20250929.

Hello,

We are using the GraphQL API and rebuilding the “Total Sales by Order” report in Shopify’s Admin Analytics dashboard. In this report the Order Line Items are grouped by month.

Using the processedAt timestamp in the Order data, this works for most of the cases. However, there were some instances where the Line Item month does not use the processedAt timestamp. For example, even though the processedAt timestamp is August 2024, some Line Items in the order appeared under September 2024 when you use the “Total Sales by Order” report.

Some things we tried are:

  • using the refund timestamp if the lineItem is refunded

  • using the fulfillment updatedAt timestamp if the fulfillment status is “SUCCESS”

While the above works for the specific Orders in question, this does not work for the general case. Are there other scenarios/logic that we need to take into account in determining where the lineItem month should be?