THE LINUX FOUNDATION PROJECTS
Docs navigation
On this page

    Compare billed cost per subaccount to budget

    This query uses the ProviderName column. ProviderName is deprecated in v1.3 and will be removed in v1.4.

    FOCUS Versions

    v1.0 v1.1 v1.2

    Context

    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).

    FOCUS SQL Query

    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

    FOCUS Datasets

    FOCUS Columns