/* # Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. */ -- View for reporting tools -- IMPORTANT: This is the one place in this repository where "net cost" is defined. Alter definition here as needed. -- NOTE: This file will fail the Compiled queries check in right-nav of Dataform -- but will execute fine once wrapped in a CREATE VIEW when executed in a workflow config { type: "view", name: "vw_gcp_billing_export_daily_summary", //tags: ["createViews"], --not needed for initialization description: "Daily summary of the GCP Billing export. Includes all fields from table plus a calculated net cost.", columns: { usage_start_date: "Must include a filter on this field", total_net_cost: "Cost plus all credits besides promotions, and excluding any invoice costs such as tax and adjustments" } } select daily.* , case when service_description != 'Invoice' then (total_cost+total_fcud_legacy-total_promotion) else 0 end as total_net_cost , case when service_description in ( 'Marketplace', 'Support', 'Chronicle' -- add other subscription services here to centralize filter definition ) THEN true ELSE false END AS is_subscription from ${ref(dataform.projectConfig.vars.daily_summary_table_name)} daily