store_ credit_ summaries
The store_credit_summaries schema captures store credit balances as point-in-time snapshots. It's the summary view that pairs with the transaction-level store credit data, and it's best for tracking balances over a period.
Anchor to Use casesUse cases
- Period balances: Show
starting_store_credit_balanceandending_store_credit_balanceby day or month to track outstanding store credit liability over time. - Movement by currency: Group
store_credit_balance_net_changebystore_credit_currencyto see which currencies drive changes in credit balance.
ShopifyQL
Examples
Description
Split the `ending_store_credit_balance` your store owes over the last seven days by currency. This example uses [`WITH TOTALS`](/docs/api/shopifyql/latest/syntax/with#total-columns) to add a total beside the per-currency breakdown.
ShopifyQL
FROM store_credit_summaries SHOW ending_store_credit_balance GROUP BY store_credit_currency WITH TOTALS SINCE -7d UNTIL today ORDER BY ending_store_credit_balance DESC VISUALIZE ending_store_credit_balance TYPE donutDescription
Compare monthly `store_credit_balance_net_change` for the year to date against the same months last year. This example uses [`WITH TOTALS`](/docs/api/shopifyql/latest/syntax/with#total-columns) to add the year-to-date total net change beside the monthly bars.
ShopifyQL
FROM store_credit_summaries SHOW store_credit_balance_net_change TIMESERIES month WITH TOTALS DURING this_year COMPARE TO previous_year ORDER BY month ASC VISUALIZE store_credit_balance_net_change TYPE barDescription
Track monthly `starting_store_credit_balance` this year as a running total. This example uses [`CUMULATIVE_VALUES`](/docs/api/shopifyql/latest/syntax/with#cumulative-values) to carry each month's balance forward into a year-to-date running total.
ShopifyQL
FROM store_credit_summaries SHOW starting_store_credit_balance TIMESERIES month WITH CUMULATIVE_VALUES, TOTALS DURING this_year ORDER BY month ASC VISUALIZE starting_store_credit_balance TYPE lineDescription
Rank the 10 `store_credit_currency` values with the highest `starting_store_credit_balance` last month. This example pairs [`ORDER BY`](/docs/api/shopifyql/latest/syntax/order-by) `starting_store_credit_balance DESC` with `LIMIT 10`, so the sort decides which 10 currencies survive the cut.
ShopifyQL
FROM store_credit_summaries SHOW starting_store_credit_balance GROUP BY store_credit_currency WITH TOTALS DURING last_month ORDER BY starting_store_credit_balance DESC LIMIT 10 VISUALIZE starting_store_credit_balance TYPE horizontal_bar
Anchor to MetricsMetrics
Counts and calculations that let you track key business indicators. Metrics show up as the columns when queried.
Metrics you can use when querying .
- Anchor to ending_store_credit_balanceending_
store_ credit_ balanceending_ store_ credit_ balance MONEYMONEY - Anchor to starting_store_credit_balancestarting_
store_ credit_ balancestarting_ store_ credit_ balance MONEYMONEY - Anchor to store_credit_balance_net_changestore_
credit_ balance_ net_ changestore_ credit_ balance_ net_ change MONEYMONEY
MONEY
A monetary amount representing currency values such as prices, revenue, costs, and discounts.
Anchor to DimensionsDimensions
Attributes of your data that let you look more granularly at aspects of the data. Group and filter by dimensions to shape the rows your query returns.
Dimensions you can use when querying .
- Anchor to daydaydayDAY_TIMESTAMPDAY_TIMESTAMP
Day (timestamp) the data was recorded
- Anchor to monthmonthmonthMONTH_TIMESTAMPMONTH_TIMESTAMP
Month (timestamp) the data was recorded
- Anchor to quarterquarterquarterQUARTER_TIMESTAMPQUARTER_TIMESTAMP
Quarter (timestamp) the data was recorded
- Anchor to shop_idshop_
idshop_ id IDENTITYIDENTITY - Anchor to store_credit_currencystore_
credit_ currencystore_ credit_ currency STRINGSTRING Values are currency codes such as USD, EUR, GBP, and CAD.
- Anchor to weekweekweekWEEK_TIMESTAMPWEEK_TIMESTAMP
Week (timestamp) the data was recorded
- Anchor to yearyearyearYEAR_TIMESTAMPYEAR_TIMESTAMP
Year (timestamp) the data was recorded
- Anchor to shop_nameshop_
nameshop_ name STRINGSTRING Name of your store
DAY_TIMESTAMP
A date value truncated to day precision.
MONTH_TIMESTAMP
A date value representing the start of a month.
QUARTER_TIMESTAMP
A date value representing the start of a fiscal quarter.
IDENTITY
A unique identifier for a Shopify resource such as a customer, product, or order.
STRING
A sequence of characters representing text data.
WEEK_TIMESTAMP
A date value representing the start of a week.
YEAR_TIMESTAMP
A date value representing the start of a year.
store_credit_transactions: Individual credit and debit events that drive these balances.payments: Transaction data when you want to see how store credit is used at checkout.payouts: Payout amounts alongside store-credit liability for a full cash picture.