Compare billed cost per subaccount to budget
Product wants to confirm charges are in line with expectations (budgets) for a business which has all its cost within a single subaccount. The ChargePeriod is used for filtering to capture items that apply to the period only (excludes adjustments from previous periods that were applied in the current BillingPeriod).
- Source
- FOCUS MCP snapshot
- FOCUS editions
- v1.0, v1.1, v1.2
- Queries
- 1
- Mode
- Read-only
- Library snapshot (UTC)
- 2026-10-08
This query uses the ProviderName column. ProviderName is deprecated in v1.3 and will be removed in v1.4.
Compare billed cost per subaccount to budget
Runs on sample- Source
- FOCUS 1.0 sample
- Result rows
- 1
- Status
- Runs on sample
- Execution
- Precomputed
- Result snapshot (UTC)
- 2026-10-11
Subaccount billed usage cost
$1,430.99
Total billed cost
1 row. Scroll inside the table to see more.
Inspect Postgres SQL and original FOCUS SQL
Postgres SQL, as run
select provider_name as provider_name,
sub_account_id as sub_account_id,
sub_account_name as sub_account_name,
sum(billed_cost) as total_billed_cost
from focus.cost_and_usage
where charge_category = 'Usage'
and charge_period_start >= $1::timestamptz
and charge_period_end <= $2::timestamptz
and provider_name = $3::text
and sub_account_id = $4::text
group by provider_name, sub_account_id, sub_account_name
order by provider_name, sub_account_id, sub_account_name nulls last
limit 500Original FOCUS SQL
SELECT ProviderName, SubAccountId, SubAccountName, SUM(BilledCost) AS TotalBilledCost FROM focus_data_table WHERE ChargeCategory = 'Usage' AND ChargePeriodStart >= ? and ChargePeriodEnd <= ? AND ProviderName = ? AND SubAccountId = ? GROUP BY ProviderName, SubAccountId, SubAccountName
Columns used
Column names from the source use case.