Billing Queries Skill
Do NOT search for semantic views for billing questions. Billing data lives in
SNOWFLAKE.ORGANIZATION_USAGEviews:USAGE_IN_CURRENCY_DAILY,REMAINING_BALANCE_DAILY,CONTRACT_ITEMS, andRATE_SHEET_DAILY. Skipcortex semantic-views search/discoverandSHOW DATABASES— go directly to the reference files below.Never use
SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORYfor spending or cost questions. That view contains credits only — no dollar amounts. Always useSNOWFLAKE.ORGANIZATION_USAGE.USAGE_IN_CURRENCY_DAILYfor any monetary spending question.
When to Use
Use this skill for org-level billing queries:
- Spend analysis: "How much am I spending?", "Which accounts cost the most?", "Monthly spend trend", "Spending by service type"
- Balance tracking: "What is my remaining balance?", "On-demand vs capacity usage", "Free usage balance"
- Contract details: "When does my contract expire?", "Contract utilization", "Contract start/end dates", "Contract value", "How long is my contract?"
- Rates and pricing: "What is my effective compute rate?", "Rate comparison across accounts", "Pricing per service"
- Reconciliation: "Reconcile my billing statement", "Total consumed", "What is on my bill?"
When NOT to Use
| Question type | Use instead |
|---|---|
| Single-account credit usage, per-warehouse costs, per-feature credits | cost-intelligence skill |
| "How much is my warehouse costing?" or "Top users by credits" | cost-intelligence skill |
| Invoices (marketplace, billing documents, consumption invoices) | Parent skill routes to the appropriate invoice sub-skill |
In short: dollars/currency → this skill, credits only → cost-intelligence. This includes service type breakdowns — "which services cost the most money" is a dollar question that belongs here, even though cost-intelligence also has service data in credits.
Access Requirements
This skill requires the ORGADMIN role. If the user gets an access error or lacks the role, defer to the organization-management skill (organization-management/org-usage-view/SKILL.md) for role troubleshooting, access grants, and SNOWFLAKE database role mapping.
References
Read the appropriate reference file before writing any billing query.
| User intent | Reference file |
|---|---|
| Spend queries (total, by account, by service, trends, what's on my bill), reconcile billing statement / total consumed | ../references/queries/usage-in-currency.md |
| Remaining balance, capacity balance, on-demand accrual, balance trend | ../references/queries/remaining-balance-daily.md |
| Contract details, contract value, utilization, expiration, contract start (effective) date, termination date, contract duration/length, renewal window, contract modified date | ../references/queries/contract-items.md |
| Effective rates, pricing per service, rate history, rate comparison | ../references/queries/rate-sheet-daily.md |
Never write ad-hoc queries when a verified query exists in a reference file.
Stopping Points
- ✋ Access denied / missing ORGADMIN: Direct user to
organization-management/org-usage-view/SKILL.md. - ✋ METERING_HISTORY is the wrong table: If you are about to write
FROM SNOWFLAKE.ACCOUNT_USAGE.METERING_HISTORYfor any spend, cost, trend, or service-type question — STOP. Replace it withFROM SNOWFLAKE.ORGANIZATION_USAGE.USAGE_IN_CURRENCY_DAILY. METERING_HISTORY has noUSAGE_IN_CURRENCYcolumn and cannot answer dollar questions. This applies to: monthly spend trend, spend by service type, total org spend, and any question involving dollar amounts. - ✋ Missing 30-day renewal explanation: Before finalizing your answer for any contract termination, expiration, or days remaining question — verify your answer to the user includes the sentence: "If the contract is not renewed within 30 days of the expiration date, the Snowflake relationship terminates." If it does not, add it.
Critical Non-Obvious Details
Always explain these when they appear in queries or results:
USAGE_IN_CURRENCY_DAILY
| Column | Meaning |
|---|---|
BALANCE_SOURCE |
Which contract bucket paid for this usage: capacity, rollover, free usage, overage (on-demand, all balances exhausted), rebate |
BILLING_TYPE |
Charge category: CONSUMPTION (normal consumption), REBATE (credit back), ADJUSTMENT (correction) |
IS_ADJUSTMENT |
TRUE = billing correction row. Include by default; only exclude if user explicitly asks for raw usage without corrections |
REMAINING_BALANCE_DAILY
| Column | Meaning |
|---|---|
ON_DEMAND_CONSUMPTION_BALANCE |
Negative value (e.g. -250) representing on-demand charges accrued. Resets after month-close (~3rd–4th of next month) |
ROLLOVER_BALANCE |
Unused credits rolled over from prior contract term |
CONTRACT_ITEMS
| Column | Meaning |
|---|---|
CONTRACT_ITEM |
One of: capacity, additional capacity, free usage |
AMOUNT |
In currency (e.g. USD), not credits |
START_DATE |
The date the contract item went into effect (the contract effective/start date) |
EXPIRATION_DATE |
May be NULL — see below |
Always explain what START_DATE means when responding about contract start date, effective date, or any query that returns
START_DATEvalues. Include this sentence in your answer to the user: "START_DATEis the date the contract item went into effect — this is the contract effective (start) date."
Contract effective (start) date — use this exact query (never
SELECT *):SELECT CONTRACT_NUMBER, MIN(START_DATE) AS CONTRACT_EFFECTIVE_DATE FROM SNOWFLAKE.ORGANIZATION_USAGE.CONTRACT_ITEMS WHERE START_DATE IS NOT NULL GROUP BY CONTRACT_NUMBER ORDER BY CONTRACT_NUMBER;Your answer to the user must include: the contract number, the date, and the START_DATE explanation above.
Contract termination date — use this exact query (use
EXPIRATION_DATE, NOTEND_DATE):SELECT CONTRACT_NUMBER, MAX(EXPIRATION_DATE) AS TERMINATION_DATE, DATEDIFF('day', CURRENT_DATE, MAX(EXPIRATION_DATE)) AS DAYS_UNTIL_TERMINATION FROM SNOWFLAKE.ORGANIZATION_USAGE.CONTRACT_ITEMS GROUP BY CONTRACT_NUMBER ORDER BY CONTRACT_NUMBER;
EXPIRATION_DATEgoverns the Snowflake relationship termination.END_DATEis the date a contract line item stops being used — these are not the same. Always queryEXPIRATION_DATEfor termination questions.If
EXPIRATION_DATEreturnsNULL, tell the user: "Your contract does not have a termination date recorded in Snowflake. Contact your Snowflake account team for contract term details."
Always explain the 30-day renewal window when responding about contract termination, expiration, or days remaining. Include this sentence in your answer to the user: "If the contract is not renewed within 30 days of the expiration date, the Snowflake relationship terminates." This applies even when
EXPIRATION_DATEisNULL.Contracts with no termination date: Not all contracts have an
EXPIRATION_DATEset. When a user asks about contract termination, expiration, renewal, or days remaining and the query returnsNULLforEXPIRATION_DATE, you must explicitly tell the user: "Your contract does not have a termination date recorded in Snowflake. Contact your Snowflake account team for contract term details." Never silently omit contracts with no termination date or present results as if all contracts have one.
Reconciliation — "Total Consumed" on billing statement:
⚠️ Critical: "Total Consumed" is cumulative from contract start — not a single month. Use this exact query (replace the date with the last day of the statement month):
SELECT CONTRACT_NUMBER, SUM(USAGE_IN_CURRENCY) AS TOTAL_CONSUMED FROM SNOWFLAKE.ORGANIZATION_USAGE.USAGE_IN_CURRENCY_DAILY WHERE USAGE_DATE <= LAST_DAY(TO_DATE('YYYY-MM-01')) AND LOWER(BALANCE_SOURCE) != 'overage' GROUP BY CONTRACT_NUMBER ORDER BY CONTRACT_NUMBER;Rules you must not break:
- No lower bound on the date —
USAGE_DATE <= LAST_DAY(...)only, neverUSAGE_DATE >= ...- Exclude overage —
AND LOWER(BALANCE_SOURCE) != 'overage'. Overage is billed separately.- Group by CONTRACT_NUMBER — an org may have multiple contracts.
- Small rounding differences (a few cents to <$10) are normal.
The billing statement's "Remaining Balance" =
CAPACITY_BALANCE + FREE_USAGE_BALANCE + ROLLOVER_BALANCE(excludesON_DEMAND_CONSUMPTION_BALANCE).