diff --git a/cost-observability/Account Usage Dashboard v2.lvdash.json b/cost-observability/Account Usage Dashboard/Account Usage Dashboard v2.lvdash.json similarity index 99% rename from cost-observability/Account Usage Dashboard v2.lvdash.json rename to cost-observability/Account Usage Dashboard/Account Usage Dashboard v2.lvdash.json index 7b3908a7..f5d36352 100644 --- a/cost-observability/Account Usage Dashboard v2.lvdash.json +++ b/cost-observability/Account Usage Dashboard/Account Usage Dashboard v2.lvdash.json @@ -1 +1 @@ -{"datasets":[{"name":"cd4e3c97","displayName":"select_yes_no_tag_show_mismatch","queryLines":["select explode(array(\n"," 'Not Matched Only',\n"," 'Matched Only',\n"," 'All Usage'\n",")) as toggle"]},{"name":"46222f11","displayName":"select_dbus_dollars_toggle","queryLines":["select explode(array(\n"," 'DBUs',\n"," 'Dollars'\n",")) as toggle"]},{"name":"2733d12f","displayName":"select_time_key_overview","queryLines":["select explode(array(\n"," 'Day',\n"," 'Week',\n"," 'Month',\n"," 'Quarter',\n"," 'Year'\n",")) as time_key"]},{"name":"078fbf24","displayName":"select_group_key","queryLines":["select explode(array(\n"," 'Workspace',\n"," 'Product',\n"," 'SKU'\n"," --'Photon',\n"," --'Serverless'\n",")) as group_key"]},{"name":"1c899adf","displayName":"select_workspace","queryLines":["with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n",")\n","\n","SELECt DISTINCT workspace_full_name from workspace"]},{"name":"c93a48f4","displayName":"select_tag_key","queryLines":["with\n","-- parse workspaces json\n","workspace as (\n"," select explode(\n"," map_entries(from_json('$$$__WORKSPACES_JSON__$$$', 'map'))\n"," ) as kvp,\n"," kvp['key'] as workspace_id,\n"," kvp['value'] as workspace_name\n","),\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else concat(workspace_name, ' (id: ', u.workspace_id, ')')\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," left join workspace\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *\n"," from usage_with_ws_filtered_by_date\n"," where if(:param_workspace='', true, workspace = :param_workspace) -- all workspaces under account, or single workspace\n","),\n","-- query\n","tag_key_selection as (\n"," select\n"," distinct(explode(map_keys(custom_tags))) as tag_key\n"," from usage_filtered\n",")\n","select * from tag_key_selection"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":""}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}}]},{"name":"f768db5b","displayName":"select_rank_key","queryLines":["with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," usage_metadata\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","-- enumerate all usage_metadata keys\n","usage_metadata_keys as (\n"," select\n"," distinct(explode(\n"," map_keys(from_json(\n"," to_json(usage_metadata),\n"," 'map'\n"," ))\n"," )) as rank_key\n"," from usage_filtered\n",")\n","select explode(array('workspace', 'run_as')) as rank_key\n","union all\n","select rank_key from usage_metadata_keys"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}]},{"name":"eb49bbaa","displayName":"select_serverless_flag","queryLines":["select explode(array(\n"," 'all',\n"," 'Serverless',\n"," 'Classic'\n",")) as group_key"]},{"name":"a5da9d48","displayName":"select_billing_origin_product","queryLines":["SELECT DISTINCT billing_origin_product \n","FROM system.billing.usage\n","WHERE billing_origin_product IS NOT NULL"]},{"name":"988516d6","displayName":"select_tag_group","queryLines":["select explode(array(\n"," 'Tag Key-Value Pairs',\n"," 'Workspace',\n"," 'Product',\n"," 'SKU',\n"," --'Serverless',\n"," --'Photon',\n"," 'Matched Status'\n",")) as group_key"]},{"name":"629a2ebe","displayName":"select_tag_agg_toggle","queryLines":["select explode(array(\n"," 'Key-Value Pairs',\n"," 'Keys'\n",")) as toggle"]},{"name":"8b6b5367","displayName":"select_tag_agg_top_tags","queryLines":["select explode(array(\n"," 'Key-Value Pairs',\n"," 'Keys',\n"," 'Values'\n",")) as toggle"]},{"name":"bb990f09","displayName":"select_include_remaining","queryLines":["select explode(array(\n"," 'Yes',\n"," 'No'\n",")) as toggle"]},{"name":"2b5e3641","displayName":"select_case_sensitivity","queryLines":["select explode(array(\n"," 'Yes',\n"," 'No'\n",")) as toggle"]},{"name":"17558292","displayName":"select_feature_flag_toggle","queryLines":["select explode(array(\n"," 'Enabled',\n"," 'Disabled'\n",")) as toggle"]},{"name":"1100555f","displayName":"select_account_prices_toggle","queryLines":["select explode(array(\n"," 'system.billing.list_prices',\n"," 'system.billing.account_prices'\n",")) as toggle"]},{"name":"eb3d55f9","displayName":"select_enable_links_toggle","queryLines":["select explode(array(\n"," 'Enabled',\n"," 'Disabled'\n",")) as toggle"]},{"name":"6b9e03f6","displayName":"usage_overview","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","clean_results AS (\n","-- query\n","select\n"," time_key, group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd_dynamic,\n"," usage_usd,\n"," usage_unit,\n"," usage_dbus,\n"," IsServerless, \n"," workspace_norm,\n"," 'Actuals' AS usage_type,\n"," CONCAT('per ', CAST(:param_time_key AS STRING)) AS time_period,\n"," start_time AS start_time_window,\n"," end_time AS end_time_window,\n"," CONCAT(CAST(start_time AS STRING), ' to ', CAST(end_time AS STRING)) AS time_window_string\n","from list_priced_usd_with_time_and_group_keys\n",")\n","\n","SELECT * FROM clean_results"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}}],"columns":[{"displayName":"Avg USD Spent","description":"","expression":"AVG(usage_usd)"},{"displayName":"period_run_rate","description":"","expression":"try_divide(SUM(usage_usd), COUNT(DISTINCT time_key))"}]},{"name":"e1dac524","displayName":"usage_forecast","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","clean_results AS (\n","select\n"," time_key,\n"," SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) AS usage_usd_dynamic,\n"," 'Actuals' AS usage_type,\n"," MIN(start_time) AS start_time_window,\n"," MAX(end_time) AS end_time_window\n","from list_priced_usd_with_time_and_group_keys\n","group by time_key\n","),\n","\n","--- AI Forecast & PoP change\n","\n","forecast AS (\n","\n"," WITH time_range AS (\n"," SELECT \n"," CASE WHEN :param_time_key = 'Month' THEN timestampadd(MONTH, :units_to_predict, now()) \n"," WHEN :param_time_key = 'Day' THEN timestampadd(DAY, :units_to_predict, now())\n"," WHEN :param_time_key = 'Week' THEN timestampadd(WEEK, :units_to_predict, now())\n"," WHEN :param_time_key = 'Quarter' THEN timestampadd(QUARTER, :units_to_predict, now())\n"," WHEN :param_time_key = 'Year' THEN timestampadd(YEAR, :units_to_predict, now())\n"," ELSE timestampadd(MONTH, :units_to_predict, now())\n"," END AS end_time,\n"," :forecast_toggle AS forecast_toggle\n"," \n"," )\n","\n"," SELECT *,\n"," MIN(time_key) OVER() AS start_time_window,\n"," MAX(time_key) OVER() AS end_time_raw,\n"," CASE \n"," WHEN UPPER(:param_time_key) = 'DAY' THEN DATE_ADD(end_time_raw, 0) -- Same day\n"," WHEN UPPER(:param_time_key) = 'WEEK' THEN DATE_ADD(end_time_raw, 6)\n"," WHEN UPPER(:param_time_key) = 'MONTH' THEN DATE_ADD(DATE_TRUNC('MONTH', ADD_MONTHS(end_time_raw, 1)), -1)\n"," WHEN UPPER(:param_time_key) = 'QUARTER' THEN DATE_ADD(DATE_TRUNC('QUARTER', ADD_MONTHS(end_time_raw, 3)), -1)\n"," WHEN UPPER(:param_time_key) = 'YEAR' THEN DATE_ADD(DATE_TRUNC('YEAR', ADD_MONTHS(end_time_raw, 12)), -1)\n"," END AS end_time_window\n"," FROM AI_FORECAST(\n"," TABLE (clean_results),\n"," horizon => (SELECT MAX(end_time) FROM time_range),\n"," time_col => 'time_key',\n"," value_col => ARRAY('usage_usd_dynamic'),\n"," prediction_interval_width => 0.9,\n"," parameters => '{\"global_floor\": 0}'\n"," )\n"," WHERE usage_usd_dynamic_forecast IS NOT NULL\n",")\n","\n","SELECT time_key, usage_usd_dynamic, NULL AS upper_forecast, NULL AS lower_forecast, usage_type, :param_time_key AS time_period,\n","start_time_window,\n","end_time_window,\n","CONCAT(CAST(start_time_window AS STRING), ' to ', CAST(end_time_window AS STRING)) AS time_window_string\n","FROM clean_results\n","UNION ALL \n","SELECT time_key, usage_usd_dynamic_forecast AS usage_usd_dynamic, usage_usd_dynamic_upper AS upper_forecast, usage_usd_dynamic_lower AS lower_forecast , 'Forecast' AS usage_type, :param_time_key AS time_period,\n","start_time_window,\n","end_time_window,\n","CONCAT(CAST(start_time_window AS STRING), ' to ', CAST(end_time_window AS STRING)) AS time_window_string\n","FROM forecast WHERE CASE WHEN :forecast_toggle = 'Enabled' THEN true ELSE false END"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"units_to_predict","keyword":"units_to_predict","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"5"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"forecast_toggle","keyword":"forecast_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}}],"columns":[{"displayName":"Avg USD Spent","description":"","expression":"AVG(usage_usd_dynamic)"},{"displayName":"forecasted_run_rate","description":"","expression":"try_divide(SUM(CASE WHEN usage_type = 'Forecast' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Forecast' THEN time_key END))\n"},{"displayName":"actuals_run_rate","description":"","expression":"try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n"},{"displayName":"forecast_percent_increase","description":"","expression":"try_divide(\n try_divide(SUM(CASE WHEN usage_type = 'Forecast' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Forecast' THEN time_key END)) \n - \n try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n ,\n try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n)"}]},{"name":"f14c46e1","displayName":"usage_overview_pop_matrix","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n"," WHERE \n"," (array_contains(:is_serverless, IsServerless) OR array_contains(:is_serverless,'all'))\n","),\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," replace(replace(group_key, '<', '<'), '>', '>') as group_key,\n"," -- Make dynamic\n"," SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) AS usage_usd\n"," from list_priced_usd_with_time_and_group_keys\n"," group by all\n","),\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round((usage_usd - prev_usage_usd) / prev_usage_usd * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round((sum(usage_usd) - prev_usage_usd) / prev_usage_usd * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","\n","pre_format_results AS (\n","-- query\n","select\n"," group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' \n"," THEN concat('$', format_number(float(`Start to End date`), 0))\n"," WHEN :usage_toggle = 'DBUs'\n"," THEN concat('', format_number(float(`Start to End date`), 0))\n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," '' as group_key,\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT *,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," -- add data bars\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n"," FROM pre_format_results\n","order by _order asc, _all_time_usage_usd desc"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"a28f5b19","displayName":"tag_analysis_top_tags","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd,\n"," workspace,\n"," IsServerless,\n"," IsPhoton,\n"," billing_origin_product,\n"," explode(custom_tags)\n","FROM list_priced_usd AS u\n","),\n","\n","pre_filter AS (\n","SELECT\n"," CASE WHEN :top_tag_aggregate_by = 'Keys' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN trim(lower(key)) ELSE key END \n"," WHEN :top_tag_aggregate_by = 'Key-Value Pairs' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN CONCAT(COALESCE(lower(trim(key)), ''), '=', COALESCE(lower(trim(value)), '')) END\n"," WHEN :top_tag_aggregate_by = 'Values' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN trim(lower(value)) ELSE value END\n"," END AS dynamic_tag_rollup,\n","workspace,\n","time_key,\n","IsServerless, \n","IsPhoton, \n","billing_origin_product, \n","SUM(usage_usd) AS usage_usd\n","FROM exploded_usage_tags_to_compare\n","GROUP BY ALL\n","),\n","\n","tag_rank AS (\n","SELECT\n","dynamic_tag_rollup,\n","SUM(usage_usd) AS usage_usd,\n","ROW_NUMBER() OVER(ORDER BY SUM(usage_usd) DESC) AS tag_rank_number\n","FROM pre_filter\n","GROUP BY dynamic_tag_rollup\n",")\n","\n","\n","SELECT p.*, tag_rank_number\n","FROM pre_filter p \n","INNER JOIN tag_rank tr ON p.dynamic_tag_rollup = tr.dynamic_tag_rollup\n","WHERE tag_rank_number <= :top_n_tags"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"top_tag_aggregate_by","keyword":"top_tag_aggregate_by","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Keys"}]}}},{"displayName":"top_n_tags","keyword":"top_n_tags","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"10"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}],"columns":[{"displayName":"tag_match_rate","description":"Matched Usage divided by total usage","expression":"coalesce(try_divide(Measure_MatchedUsage,usage_usd), 0.0)\n"}]},{"name":"d61a4eeb","displayName":"tag_analysis_summary","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (SELECT record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '', '') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select\n"," mt._custom_tag_key_value_pairs,\n"," COALESCE(mt.custom_tag_key_value_pairs, '') AS custom_tag_key_value_pairs,\n"," -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," COALESCE(IsMatched, '') AS IsMatchedClean,\n"," array_distinct(mt.matched_tags_array) AS kvp,\n"," k.*\n"," from\n"," list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n","),\n","\n","\n","pre_ui_results AS (\n"," -- query\n"," select\n"," time_key,\n"," IsServerless,\n"," IsPhoton,\n"," workspace AS workspace_id,\n"," billing_origin_product,\n"," sku_name,\n"," IsMatchedClean,\n"," CASE\n"," WHEN custom_tag_key_value_pairs IN ('', '')\n"," OR :normalize_case = 'No' THEN custom_tag_key_value_pairs\n"," ELSE lower(custom_tag_key_value_pairs)\n"," END AS custom_tag_key_value_pairs,\n"," -- Make dynamic\n"," CASE\n"," WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd,\n"," kvp\n"," from\n"," list_priced_usd_with_matching_tag_kvp\n"," where\n"," (\n"," CASE\n"," WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN custom_tag_key_value_pairs IN ('', '')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN custom_tag_key_value_pairs NOT IN ('', '')\n"," END\n"," )\n",")\n","SELECT\n"," CASE\n"," WHEN :tag_group = 'Workspace' THEN workspace_id\n"," WHEN :tag_group = 'Product' THEN billing_origin_product\n"," WHEN :tag_group = 'SKU' THEN sku_name\n"," WHEN :tag_group = 'Matched Status' THEN IsMatchedClean\n"," WHEN :tag_group = 'Tag Key-Value Pairs' THEN custom_tag_key_value_pairs\n"," WHEN :tag_group = 'Photon' THEN IsPhoton\n"," WHEN :tag_group = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," CASE\n"," WHEN IsMatchedClean = '' THEN usage_usd\n"," ELSE 0\n"," END AS Measure_MatchedUsage,\n"," *\n","FROM\n"," pre_ui_results"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"tag_group","keyword":"tag_group","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Tag Key-Value Pairs"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}],"columns":[{"displayName":"tag_match_rate","description":"Matched Usage divided by total usage","expression":"coalesce(try_divide(Measure_MatchedUsage,usage_usd), 0.0)\n"}]},{"name":"437db86b","displayName":"tag_analysis_pop_matrix","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (SELECT record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '<NO TAG MATCH>', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '<TAG MATCH>', '<NO TAG MATCH>') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select mt._custom_tag_key_value_pairs,\n"," COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') AS custom_tag_key_value_pairs, -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," COALESCE(IsMatched, '<NOT TAGGED>') AS IsMatchedClean,\n"," mt.matched_tags_array AS kvp,\n"," k.*\n"," from list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n"," where\n"," (CASE WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," END)\n"," ),\n","\n","total_match_percent AS (\n","select\n"," sum(if(custom_tag_key_value_pairs NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>'), -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END, 0)) as match_usage_usd,\n"," sum( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) as total_usage_usd,\n"," round(try_divide(match_usage_usd , total_usage_usd), 3) as tag_match_percentage\n","from list_priced_usd_with_matching_tag_kvp\n","),\n","\n","\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," CASE\n"," WHEN :tag_group = 'Workspace' THEN workspace\n"," WHEN :tag_group = 'Product' THEN billing_origin_product\n"," WHEN :tag_group = 'SKU' THEN sku_name\n"," WHEN :tag_group = 'Matched Status' THEN IsMatchedClean\n"," WHEN :tag_group = 'Tag Key-Value Pairs' THEN custom_tag_key_value_pairs\n"," WHEN :tag_group = 'Photon' THEN IsPhoton\n"," WHEN :tag_group = 'Serverless' THEN IsServerless\n"," END AS group_key, -- Make results aggregation optionally case sensitive\n"," sum( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) as usage_usd\n"," from list_priced_usd_with_matching_tag_kvp\n"," group by all\n","),\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round(try_divide((usage_usd - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round(try_divide((sum(usage_usd) - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","-- query\n","\n","results_pre_format AS (\n","select\n"," CASE WHEN group_key IN ('<NOT TAGGED>', '<NO TAG MATCH>', '<TAG MATCH>', 'TOTAL') OR :normalize_case = 'No' THEN group_key ELSE lower(group_key) END AS group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' \n"," THEN concat('$', format_number(float(`Start to End date`), 0))\n"," WHEN :usage_toggle = 'DBUs'\n"," THEN concat('', format_number(float(`Start to End date`), 0))\n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n","\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," CONCAT(' ', round((SELECT MAX(tag_match_percentage) FROM total_match_percent)*100, 2)::string,'% of usage matching tag search') as group_key, -- This is the formatted total matching percent across tags\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT *,\n","CONCAT(\n"," '', \n"," group_key, \n"," ''\n"," ) AS group_key_html,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n","FROM results_pre_format\n","order by _order asc, _all_time_usage_usd desc;"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"tag_group","keyword":"tag_group","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Tag Key-Value Pairs"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"450b2674","displayName":"tag_analysis_match_details","queryLines":["SET ansi_mode = True;\n","\n","WITH workspace AS (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select \n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," workspace_name,\n"," workspace_url,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where\n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," -- Serverless Filter\n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select \n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," u.*,\n"," COALESCE(\n"," (SELECT /*+ BROADCAST(ce) */ MAX(clean_room_name) FROM system.access.clean_room_events ce WHERE ce.central_clean_room_id = usage_metadata.central_clean_room_id),\n"," (SELECT /*+ BROADCAST(se) */ MAX(endpoint_name) FROM system.serving.served_entities se WHERE se.workspace_id = workspace_id AND se.endpoint_id = usage_metadata.endpoint_id)\n"," ) AS asset_name\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," usage_date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (\n"," SELECT\n"," record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '<NO TAG MATCH>', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '<TAG MATCH>', '<NO TAG MATCH>') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select\n"," mt._custom_tag_key_value_pairs,\n"," COALESCE(IsMatched, '<NOT TAGGED>') AS IsMatched,\n"," COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') AS custom_tag_key_value_pairs, -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," mt.matched_tags_array AS kvp,\n"," k.*,\n"," usage_metadata.job_id AS job_id,\n"," usage_metadata.cluster_id AS cluster_id,\n"," usage_metadata.dlt_pipeline_id AS dlt_pipeline_id,\n"," usage_metadata.warehouse_id AS warehouse_id\n"," from list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n"," )\n",",\n","\n","-- Dim tables to get names, deleted, and owner\n","clusters AS (\n"," SELECT /*+ REPARTITION(2, cluster_id) */\n"," workspace_id,\n"," cluster_id,\n"," cluster_name AS object_name,\n"," owned_by AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.compute.clusters\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, cluster_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY cluster_id\n","),\n","\n","jobs AS (\n"," SELECT /*+ REPARTITION(2, job_id) */\n"," workspace_id,\n"," job_id,\n"," name AS object_name,\n"," '' AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.lakeflow.jobs\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY job_id\n","),\n","\n","pipelines AS (\n"," SELECT /*+ REPARTITION(2, pipeline_id) */\n"," workspace_id,\n"," pipeline_id,\n"," name AS object_name,\n"," COALESCE(run_as, created_by) AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.lakeflow.pipelines\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, pipeline_id ORDER BY change_time DESC) = 1\n"," -- CLUSTER BY pipeline_id\n","),\n","\n","warehouses AS (\n"," SELECT /*+ REPARTITION(2, warehouse_id) */\n"," workspace_id,\n"," warehouse_id,\n"," warehouse_name AS object_name,\n"," '' AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.compute.warehouses\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, warehouse_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY warehouse_id\n","),\n","\n","\n","pre_results AS (\n","\n","select /*+ BROADCAST(j), BROADCAST(c), BROADCAST(p), BROADCAST(w) */\n","coalesce(identity_metadata.run_as, identity_metadata.owned_by, identity_metadata.created_by, j.object_owner, c.object_owner, p.object_owner) AS asset_owner,\n","CASE WHEN coalesce(j.is_deleted,c.is_deleted, p.is_deleted, w.is_deleted) = 1 THEN 'deleted'\n"," WHEN coalesce(j.is_deleted,c.is_deleted, p.is_deleted, w.is_deleted) = 0 THEN 'active'\n"," ELSE 'unknown'\n"," END AS is_deleted,\n","coalesce(tk.asset_name, j.object_name,c.object_name, p.object_name, w.object_name, 'unknown') AS clean_asset_name,\n","-----==== Route to the object itself ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN CONCAT(COALESCE(workspace_url, ''), '/compute/clusters/', usage_metadata.cluster_id) -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'JOBS' THEN CONCAT(COALESCE(workspace_url, ''), '/jobs/', usage_metadata.job_id) -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN CONCAT(COALESCE(workspace_url, ''), '/sql/warehouses/', usage_metadata.warehouse_id, '?o=', tk.workspace_id) ELSE CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id, '?o=', tk.workspace_id) END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'APPS' THEN CONCAT(COALESCE(workspace_url, ''), '/apps/', usage_metadata.app_name)\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN NULL -- background service\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN CASE WHEN asset_name IS NULL THEN NULL ELSE CONCAT(COALESCE(workspace_url, ''), '/explore/cleanrooms/', COALESCE(asset_name, usage_metadata.central_clean_room_id), '?o=', COALESCE(tk.workspace_id, '')) END\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN CONCAT('/pipelines/', usage_metadata.dlt_pipeline_id) \n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN NULL -- NOT SUPPORTED \n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN CONCAT(COALESCE(workspace_url, ''), '/ml/endpoints/', usage_metadata.endpoint_name)\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN CONCAT(COALESCE(workspace_url, ''), CONCAT('/compute/vector-search/', usage_metadata.endpoint_name), '?o=', COALESCE(tk.workspace_id, ''))\n"," WHEN billing_origin_product = 'DATABASE' THEN NULL -- TBD\n"," -- WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n","\n"," END AS asset_url_router,\n","\n","-----==== Asset Identifier (id or name if no id) ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN usage_metadata.cluster_id -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CASE WHEN usage_metadata.notebook_id IS NOT NULL THEN usage_metadata.notebook_id\n"," WHEN product_features.is_serverless = True THEN asset_owner END -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'NETWORKING' THEN CONCAT(usage_metadata.source_region, ' -> ',usage_metadata.destination_region)\n"," WHEN billing_origin_product = 'FINE_GRAINED_ACCESS_CONTROL' THEN CASE WHEN product_features.is_serverless = True THEN asset_owner END\n"," WHEN billing_origin_product = 'AGENT_EVALUATION' THEN asset_owner -- user doing agent eval\n"," WHEN billing_origin_product = 'JOBS' THEN usage_metadata.job_id -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN usage_metadata.warehouse_id ELSE usage_metadata.dlt_pipeline_id END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CASE WHEN usage_metadata.dlt_pipeline_id IS NOT NULL THEN usage_metadata.dlt_pipeline_id\n"," WHEN usage_metadata.cluster_id IS NOT NULL THEN usage_metadata.cluster_id\n"," END -- Can be pipeline id or cluster id for classic DLT\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN usage_metadata.dlt_pipeline_id\n"," WHEN billing_origin_product = 'APPS' THEN usage_metadata.app_name\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN usage_metadata.central_clean_room_id\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN usage_metadata.notebook_id -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN 'Background Service' -- background service\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN usage_metadata.dlt_pipeline_id\n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN usage_metadata.ai_runtime_pool_id\n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN usage_metadata.endpoint_name\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN usage_metadata.endpoint_id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN custom_tags.EndpointId\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN usage_metadata.cluster_id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN COALESCE(usage_metadata.endpoint_name, usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'FOUNDATION_MODEL_TRAINING' THEN usage_metadata.run_name -- TO DO - Needs better link identifier and experiemnt Id and user id\n"," WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN usage_metadata.database_instance_id -- TBD\n"," END AS asset_id,\n","\n","-----==== Type of Asset (id/name description) ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN 'All Purpose Cluster Id' -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CASE WHEN usage_metadata.notebook_id IS NOT NULL THEN 'Serverless Notebook Id'\n"," WHEN product_features.is_serverless = True THEN 'Serverless Interactive Usage' END\n"," WHEN billing_origin_product = 'NETWORKING' THEN 'Network Route'\n"," WHEN billing_origin_product = 'FINE_GRAINED_ACCESS_CONTROL' THEN CASE WHEN product_features.is_serverless = True THEN 'Fine Grained Access Filtering' END\n"," WHEN billing_origin_product = 'AGENT_EVALUATION' THEN 'User Agent Evaluation' -- user doing agent eval\n"," WHEN billing_origin_product = 'JOBS' THEN 'Workflow - Job Id' -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN 'SQL Warehouse' ELSE 'SQL - DLT ST/MVs' END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CASE WHEN usage_metadata.dlt_pipeline_id IS NOT NULL THEN 'DLT Pipeline Id'\n"," WHEN usage_metadata.cluster_id IS NOT NULL THEN 'DLT Cluster Id'\n"," END -- Can be pipeline id or cluster id for classic DLT\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN 'Online Table DLT Pipeline Id' -- 'Not yet recorded'\n"," WHEN billing_origin_product = 'APPS' THEN 'Lakehouse App Name'\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN 'Cleanroom Id / Name'\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN 'Lakeflow Pipeline Id'\n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN 'AI Runtime Pool Id'\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN 'Serverless Notebook Id'-- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN 'Predictive Optimization Usage' -- background service\n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN 'Model Serving Endpoint Name'\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN 'Model Serving Endpoint Id'\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN 'Model Serving Endpoint Id'\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN 'Model Serving Cluster Id'\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN 'Vector Search Endpoint Name' -- TO DO - Needs better link identifier and owner info - Need Vector search name\n"," WHEN billing_origin_product = 'FOUNDATION_MODEL_TRAINING' THEN 'Training Experiment Run'-- TO DO - Needs better link identifier and experiemnt Id and user id\n"," WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN 'Table Id Monitor' -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN 'Database Instance Id' -- TO DO - Needs better link identifier via database name\n"," END AS asset_type,\n"," CASE WHEN asset_id IS NOT NULL THEN 'Identified' ELSE 'Unknown Asset Id' END AS IsClassifiedIntoAsset,\n","case\n"," when :param_time_key = 'Day' then :time_range.max\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max)\n","end as current_period,\n","case\n"," when :param_time_key = 'Day' then :time_range.max - interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max - interval 1 month)\n","end as last_period,\n","tk.*\n","FROM (SELECT * \n"," FROM list_priced_usd_with_matching_tag_kvp \n"," WHERE \n"," (CASE WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN IsMatched IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN IsMatched NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," END)) AS tk\n","LEFT JOIN jobs j ON j.job_id = tk.job_id\n","LEFT JOIN clusters c ON c.cluster_id = tk.cluster_id\n","LEFT JOIN pipelines p ON p.pipeline_id = tk.dlt_pipeline_id\n","LEFT JOIN warehouses w ON w.warehouse_id = tk.warehouse_id\n","), \n","\n","agg_final AS (\n","-- Aggregate\n","SELECT\n","workspace AS workspace_id,\n","billing_origin_product,\n","asset_type,\n","asset_id,\n","CASE WHEN :enable_links_toggle = 'Enabled' THEN asset_url_router ELSE NULL END AS asset_url_router,\n","IsClassifiedIntoAsset,\n","IsServerless,\n","usage_type,\n","COALESCE(MAX(is_deleted), 'unknown') AS is_object_deleted,\n","FIRST(current_period) AS current_period,\n","FIRST(last_period) AS last_period,\n","SUM( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) FILTER(WHERE usage_date >= current_period) as current_period_usage_usd,\n","SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) FILTER(WHERE usage_date BETWEEN last_period AND current_period) as last_period_usage_usd,\n","MAX_BY(COALESCE(asset_owner), usage_end_time) AS usage_owner,\n","-- Most recent asset name (they can change)\n","MAX_BY(clean_asset_name, usage_end_time) AS MostRecentAssetName,\n","-- Most recent is matched\n","MAX_BY(IsMatched, usage_end_time) AS MostRecentIsMatched,\n","-- Most recent tag pairs\n","MAX_BY(custom_tag_key_value_pairs, usage_end_time) AS MostRecentTagKeyValuePairs,\n","-- Most recent usage date\n","MAX_BY(usage_date, usage_end_time) AS MostRecentUsageDate,\n","-- Days since most recent usage\n","date_diff(current_date()::date, MostRecentUsageDate) AS DaysSinceMostRecentUsage,\n","-- First Usage Date In Window\n","MIN_BY(usage_date, usage_end_time) AS EarliestUsageDate,\n","-- Total Usage\n","SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) AS TotalDollarsUsage,\n","SUM(usage_quantity) AS TotalDBUUsageQuantity,\n","-- Most recent custom_tags value\n","MAX_BY(custom_tags, usage_end_time) AS MostRecentTagsOnAsset,\n","-- Most recent usage metadata\n","MAX_BY(usage_metadata, usage_end_time) AS MostRecentUsageMetadata,\n","MAX_BY(product_features, usage_end_time) AS MostRecentProductFeatures\n","FROM pre_results\n","GROUP BY \n","workspace,\n","billing_origin_product,\n","asset_type,\n","asset_id,\n","CASE WHEN :enable_links_toggle = 'Enabled' THEN asset_url_router ELSE NULL END,\n","IsClassifiedIntoAsset,\n","IsServerless,\n","usage_type\n","),\n","\n","asset_ranks AS (\n","\n","SELECT \n","CONCAT(\n"," '', \n"," MostRecentIsMatched, \n"," ''\n"," ) AS MatchedKey_html,\n"," CASE WHEN MostRecentIsMatched = '<NOT TAGGED>' THEN 'NOT TAGGED'\n"," WHEN MostRecentIsMatched = '<NO TAG MATCH>' THEN 'NO TAG MATCH'\n"," WHEN MostRecentIsMatched = '<TAG MATCH>' THEN 'MATCHED'\n"," END AS clean_ui_is_matched,\n","af.*,\n"," -- PoP usage change\n"," CASE WHEN last_period_usage_usd IS NULL THEN 0 \n"," ELSE ROUND((try_divide((current_period_usage_usd - last_period_usage_usd) , last_period_usage_usd))*100, 2) END AS percent_pop_change,\n"," -- add data bars on USAGE\n"," MAX(TotalDollarsUsage) OVER() AS max_usage_dollars,\n"," MIN(TotalDollarsUsage) OVER() AS min_usage_dollars,\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(TotalDollarsUsage, 0), \n"," '
'\n"," ), CAST(TotalDollarsUsage AS STRING)) AS usage_dollars_html,\n","\n"," MAX(DaysSinceMostRecentUsage) OVER() AS max_usage_days,\n"," MIN(DaysSinceMostRecentUsage) OVER() AS min_usage_days,\n"," CONCAT(\n"," '',\n"," ROUND(DaysSinceMostRecentUsage, 1), \n"," ' days'\n"," ) AS heat_color_html,\n","ROW_NUMBER() OVER(ORDER BY TotalDollarsUsage DESC) AS top_n_asset\n","FROM agg_final af\n","\n",")\n","\n","SELECT \n","*\n","FROM asset_ranks\n","WHERE top_n_asset <= :top_n_asset\n","ORDER BY TotalDollarsUsage DESC"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"enable_links_toggle","keyword":"enable_links_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"top_n_asset","keyword":"top_n_asset","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"50"}]}}}]},{"name":"03f6453c","displayName":"top_spending_assets_summary","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," -- Serverless\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","-- eval rank_key param\n","list_priced_usd_with_rank_key as (\n"," select\n"," struct(workspace) as rank_metadata,\n"," identifier\n"," (\n"," case\n"," when :param_rank_key = 'workspace' then 'rank_metadata'\n"," when :param_rank_key = 'run_as' then 'identity_metadata'\n"," else 'usage_metadata'\n"," end\n"," )[:param_rank_key] as rank_key,\n"," *\n"," from list_priced_usd_with_time_key\n","),\n","-- calc top ranked usage\n","top_ranked_usage as (\n"," select\n"," rank_key,\n"," true as is_top_ranked,\n"," sum( \n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) as usage_usd\n"," from list_priced_usd_with_rank_key\n"," where rank_key is not null\n"," group by rank_key\n"," order by usage_usd desc\n"," limit :param_top_n\n","),\n","list_priced_usd_with_rank_key_normalized as (\n"," select\n"," if(is_top_ranked or u.rank_key is null, u.rank_key, '') as rank_key,\n"," u.time_key,\n"," u.workspace,\n"," \n"," CASE WHEN :usage_toggle = 'Dollars' THEN u.usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN u.usage_dbus\n"," ELSE u.usage_usd\n"," END AS usage_usd\n"," from list_priced_usd_with_rank_key as u\n"," left join top_ranked_usage\n"," on u.rank_key = top_ranked_usage.rank_key\n"," where \n"," CASE WHEN :include_remaining_assets = 'Yes'\n"," THEN u.rank_key is not null\n"," ELSE top_ranked_usage.rank_key IS NOT NULL\n"," END\n",")\n","\n","-- query\n","select\n"," COALESCE(rank_key, '') AS rank_key,\n"," time_key,\n"," workspace,\n"," sum(usage_usd) as usage_usd\n","from list_priced_usd_with_rank_key_normalized\n","group by all"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_rank_key","keyword":"param_rank_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"job_id"}]}}},{"displayName":"param_top_n","keyword":"param_top_n","dataType":"INTEGER","defaultSelection":{"values":{"dataType":"INTEGER","values":[{"value":"10"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"include_remaining_assets","keyword":"include_remaining_assets","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"21de1797","displayName":"top_spending_assets_pop_matrix","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," workspace_url,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," -- Serverless\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- Some links require the name, this is expensive so use sparingly\n","asset_names AS (\n"," SELECT \n"," usage_metadata.central_clean_room_id AS asset_id,\n"," MAX_BY(clean_room_name, ce.event_time) AS asset_name\n"," FROM list_priced_usd s\n"," LEFT JOIN system.access.clean_room_events ce ON ce.central_clean_room_id = s.usage_metadata.central_clean_room_id\n"," WHERE billing_origin_product = 'CLEAN_ROOM'\n"," GROUP BY usage_metadata.central_clean_room_id\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," (case\n"," when :param_time_key = 'Year' then usage_year\n"," when :param_time_key = 'Quarter' then usage_quarter\n"," when :param_time_key = 'Month' then usage_month\n"," when :param_time_key = 'Week' then usage_week\n"," when :param_time_key = 'Day' then usage_date\n"," else usage_date\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","-- eval rank_key param\n","list_priced_usd_with_rank_key as (\n"," select\n"," struct(workspace) as rank_metadata,\n"," identifier\n"," (\n"," case\n"," when :param_rank_key = 'workspace' then 'rank_metadata'\n"," when :param_rank_key = 'run_as' then 'identity_metadata'\n"," else 'usage_metadata'\n"," end\n"," )[:param_rank_key] as rank_key,\n"," *\n"," from list_priced_usd_with_time_key\n","),\n","\n","-- calc top ranked usage\n","top_ranked_usage as (\n"," select\n"," rank_key,\n"," true as is_top_ranked,\n"," sum( \n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) as usage_usd\n"," from list_priced_usd_with_rank_key\n"," where rank_key is not null\n"," group by rank_key\n"," order by usage_usd desc\n"," limit :param_top_n\n","),\n","\n","list_priced_usd_with_rank_key_normalized as (\n"," select /*+ BROADCAST(aa), BROADCAST(top_ranked_usage) */\n"," if(is_top_ranked or u.rank_key is null, u.rank_key, 'REMAINING OBJECTS') as rank_key,\n"," u.time_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN u.usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN u.usage_dbus\n"," ELSE u.usage_usd\n"," END AS usage_usd,\n","CASE WHEN u.rank_key != 'REMAINING OBJECTS' \n"," THEN coalesce(identity_metadata.run_as, identity_metadata.owned_by, identity_metadata.created_by)\n","END AS usage_owner,\n","\n","-----==== Route to the asset itself ====-----\n","CASE WHEN u.rank_key != 'REMAINING OBJECTS'\n"," THEN CASE \n"," WHEN :param_rank_key = 'workspace' THEN workspace_url\n"," WHEN :param_rank_key = 'run_as' THEN NULL\n"," WHEN billing_origin_product = 'ALL_PURPOSE' THEN CONCAT(COALESCE(workspace_url, ''), '/compute/clusters/', usage_metadata.cluster_id) -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'JOBS' THEN CONCAT(COALESCE(workspace_url, ''), '/jobs/', usage_metadata.job_id) -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN CONCAT(COALESCE(workspace_url, ''), '/sql/warehouses/', usage_metadata.warehouse_id, '?o=', workspace_id) ELSE CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id, '?o=', workspace_id) END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'APPS' THEN CONCAT(COALESCE(workspace_url, ''), '/apps/', usage_metadata.app_name)\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN NULL -- background service\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN CASE WHEN aa.asset_name IS NULL THEN NULL ELSE CONCAT(COALESCE(workspace_url, ''), '/explore/cleanrooms/', COALESCE(aa.asset_name, usage_metadata.central_clean_room_id), '?o=', COALESCE(workspace_id, '')) END\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN CONCAT('/pipelines/', usage_metadata.dlt_pipeline_id) \n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN NULL -- NOT SUPPORTED \n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN CONCAT(COALESCE(workspace_url, ''), '/ml/endpoints/', usage_metadata.endpoint_name)\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN CONCAT(COALESCE(workspace_url, ''), CONCAT('/compute/vector-search/', usage_metadata.endpoint_name), '?o=', COALESCE(workspace_id, ''))\n"," -- WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN NULL -- TO DO\n"," END\n","END AS asset_url_router\n"," from list_priced_usd_with_rank_key as u\n"," left join top_ranked_usage\n"," on u.rank_key = top_ranked_usage.rank_key\n"," left join asset_names aa ON u.usage_metadata.central_clean_room_id = aa.asset_id\n"," where\n"," CASE WHEN :include_remaining_assets = 'Yes'\n"," THEN u.rank_key is not null\n"," ELSE top_ranked_usage.rank_key IS NOT NULL\n"," END\n","),\n","\n","group_key_routes AS (\n"," SELECT rank_key,\n"," MAX_BY(asset_url_router, time_key) AS latest_asset_route,\n"," MAX_BY(usage_owner, time_key) AS latest_asset_owner\n"," FROM list_priced_usd_with_rank_key_normalized\n"," WHERE rank_key != 'REMAINING OBJECTS'\n"," GROUP BY rank_key\n","),\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," rank_key as group_key,\n"," sum(usage_usd) as usage_usd\n"," from list_priced_usd_with_rank_key_normalized\n"," group by time_key, rank_key\n","),\n","\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round(try_divide((usage_usd - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round(try_divide((sum(usage_usd) - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","\n","pre_format_results AS (\n","-- query\n","select\n"," group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN concat('$', format_number(float(`Start to End date`), 0)) \n"," WHEN :usage_toggle = 'DBUs' THEN concat('', format_number(float(`Start to End date`), 0)) \n"," ELSE concat('$', format_number(float(`Start to End date`), 0)) \n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," '' as group_key,\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT /*+ BROADCAST(gkr) */\n","r.*,\n"," CASE WHEN :enable_links_toggle = 'Enabled' THEN gkr.latest_asset_route ELSE NULL END AS latest_asset_route,\n"," gkr.latest_asset_owner,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," -- add data bars\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n"," FROM pre_format_results AS r\n"," LEFT JOIN group_key_routes AS gkr ON r.group_key = gkr.rank_key\n","order by _order asc, _all_time_usage_usd desc"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_rank_key","keyword":"param_rank_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"warehouse_id"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_top_n","keyword":"param_top_n","dataType":"INTEGER","defaultSelection":{"values":{"dataType":"INTEGER","values":[{"value":"10"}]}}},{"displayName":"include_remaining_assets","keyword":"include_remaining_assets","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"enable_links_toggle","keyword":"enable_links_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}}]},{"name":"976395d6","displayName":"contract_burndown","queryLines":["/*\n","\n","This section is a sample queries that shows how to build a contract burndown analysis given the following input params: \n","1. Contract Start Date\n","2. Contract End Date\n","3. Total Usage Amount of Contract\n","4. Total Support / Overhead amount of Contract\n","5. Discounts by product/sku list separataed by ;\n","\n","*/\n","\n","SET ansi_mode = True;\n","\n","WITH \n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","contract_dates AS (\n"," SELECT \n"," explode(days) AS usage_date\n"," FROM (\n"," SELECT sequence(:contract_start_date::date, :contract_end_date::date) AS days\n"," )\n","),\n","\n","contract_burndown AS (\n"," SELECT \n"," *,\n"," SUM(daily_amount) OVER (ORDER BY usage_date) AS cumulative_estimated_contract_usage,\n"," try_divide(cumulative_estimated_contract_usage, total_usage_amount) AS estimated_contract_used\n"," FROM (\n"," SELECT\n"," contract_dates.usage_date,\n"," :usage_amount::float AS total_usage_amount,\n"," :support_amount::float AS total_support_amount,\n"," (:usage_amount::float / (SELECT COUNT(0) FROM contract_dates)) AS daily_amount\n"," FROM contract_dates\n"," )\n","),\n","\n","-- Now tag combos can be matched in 2 separate ways: key only, or the key=value pair if optionall provided\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","\n","list_priced_usd as (\n"," select\n"," coalesce(((1-COALESCE(discounts.discount, 0))* p.pricing.default)*usage_quantity, u.usage_quantity * p.pricing.default, 0) as usage_usd,\n"," u.*\n"," from system.billing.usage as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON discounts.product = u.billing_origin_product\n"," left join prices as p\n"," on u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","daily_usage AS (\n"," SELECT \n"," u.usage_date,\n"," SUM(coalesce(((1-COALESCE(discounts.discount, 0))* p.pricing.default)*usage_quantity, u.usage_quantity * p.pricing.default, 0)) AS DollarDBUs,\n"," SUM(u.usage_quantity * p.pricing.default) AS ListDollarDBUs,\n"," SUM(usage_quantity) AS DBUs\n"," FROM system.billing.usage AS u\n"," LEFT JOIN parsed_discounts_table AS discounts ON discounts.product = u.billing_origin_product\n"," LEFT JOIN prices as p\n"," on u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n"," GROUP BY u.usage_date\n","),\n","\n","clean_burn AS (\n","\n","SELECT \n","c.*,\n","u.usage_date AS u_usage_date,\n","u.DollarDBUs,\n","u.DBUs,\n","(u.DollarDBUs / c.total_usage_amount) * total_support_amount AS SupportDollars, -- Support is burned down in proportion to the usage\n","SUM(DollarDBUs) OVER (ORDER BY c.usage_date) AS cumulative_actual_spend,\n","try_divide(cumulative_actual_spend, total_usage_amount) AS actual_contract_used,\n","-- % completion Flags\n","CASE WHEN c.usage_date < current_date() \n"," THEN 'Past Usage'\n"," WHEN c.usage_date = current_date()\n"," THEN 'Today'\n"," WHEN c.usage_date > current_date() \n"," THEN 'Future'\n"," END AS TimePeriodFlag\n","FROM contract_burndown c\n","LEFT JOIN daily_usage u ON c.usage_date = u.usage_date\n","),\n","\n","with_flags AS (\n","SELECT \n","*,\n","SUM(SupportDollars) OVER (ORDER BY usage_date) AS cumulative_actual_spend_support,\n","CASE WHEN usage_date >= current_date()\n"," THEN current_date()::date\n"," ELSE usage_date::date\n"," END AS contract_active_date,\n","CASE WHEN cumulative_actual_spend > cumulative_estimated_contract_usage\n"," THEN 'Burning Above Run Rate'\n"," ELSE 'Within Run Rate'\n"," END AS RunRateFlag,\n","CASE WHEN cumulative_actual_spend <= total_usage_amount\n"," THEN 'Within Contract'\n"," ELSE 'Burst Usage'\n"," END AS BurstFlag,\n","CASE WHEN cumulative_actual_spend > total_usage_amount\n"," THEN 1\n"," ELSE 0\n"," END AS DidBurst,\n","MAX_BY(estimated_contract_used, usage_date) FILTER (WHERE TimePeriodFlag != 'Future') AS MostRecentEstimatedBurnProportion,\n","MAX_BY(actual_contract_used, usage_date) FILTER (WHERE TimePeriodFlag != 'Future') AS MostRecentActualBurnProportion\n","FROM clean_burn\n","GROUP BY ALL\n","),\n","\n","remaining_tcv AS (\n","SELECT \n","*,\n","COALESCE((SELECT MIN(usage_date) AS burst_date\n"," FROM with_flags \n"," WHERE DidBurst = 1)::date::string, 'Not Bursting') AS BurstDate,\n"," -- Contract remaining\n"," total_usage_amount - cumulative_actual_spend AS contract_usage_remaining,\n"," total_usage_amount + total_support_amount AS total_contract_value,\n"," (total_usage_amount + total_support_amount) - (cumulative_actual_spend + cumulative_actual_spend_support) AS contract_total_remaining\n","FROM with_flags \n",")\n","\n","SELECT \n","*\n","FROM remaining_tcv\n","--WHERE u_usage_date IS NOT NULL -- Will not look into future past current usage"],"parameters":[{"displayName":"contract_start_date","keyword":"contract_start_date","dataType":"DATE","defaultSelection":{"values":{"dataType":"DATE","values":[{"value":"2024-01-01T00:00:00.000"}]}}},{"displayName":"contract_end_date","keyword":"contract_end_date","dataType":"DATE","defaultSelection":{"values":{"dataType":"DATE","values":[{"value":"now/d"}]}}},{"displayName":"usage_amount","keyword":"usage_amount","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"3000000"}]}}},{"displayName":"support_amount","keyword":"support_amount","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"500000"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]}],"pages":[{"name":"5879f9e7","displayName":"Usage Overview","layout":[{"widget":{"name":"573693eb","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081389a232fede31f38c91_group_key","query":{"datasetName":"078fbf24","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"group_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_group_key","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_group_key","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_group_key","query":{"datasetName":"e1dac524","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"group_key","displayName":"group_key","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081389a232fede31f38c91_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_group_key"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Group by Key","description":"Group usage data by one of the below dimensions"}}},"position":{"x":0,"y":2,"width":2,"height":2}},{"widget":{"name":"ba616645","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"Time"},"y":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"group_key","scale":{"type":"categorical"},"legend":{"hideTitle":true,"position":"right"},"displayName":"group_key"}},"frame":{"showTitle":true,"title":"Usage by Group Key Over Time"}}},"position":{"x":0,"y":14,"width":6,"height":8}},{"widget":{"name":"1f7ff923","queries":[{"name":"main_query","query":{"datasetName":"f14c46e1","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Key","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":1,"title":"Start to End date","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":2,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":9,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":10,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":11,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":12,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage by Group Period Over Period"}}},"position":{"x":0,"y":31,"width":6,"height":13}},{"widget":{"name":"e4d3cb0e","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"time_window_string","expression":"`time_window_string`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"sum(usage_usd)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"bold":true,"color":"#00A972","fontSize":32},"displayName":"Sum of usage_usd"},"target":{"fieldName":"time_window_string","style":{"color":{"themeColorType":"fontColor"},"italic":true,"fontSize":14},"displayName":"time_window_string"}},"frame":{"showTitle":true,"title":"Total Usage","showDescription":false,"description":"(# of usage periods)"}}},"position":{"x":2,"y":2,"width":2,"height":2}},{"widget":{"name":"37e96b43","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"usage_type","expression":"`usage_type`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"area","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"Time"},"y":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"usage_type","scale":{"type":"categorical","mappings":[{"value":"Actuals","color":"#077A9D"},{"value":"Forecast","color":"#919191"}]},"legend":{"hideTitle":true},"displayName":"usage_type"}},"frame":{"showTitle":true,"title":"Total Usage Over Time","showDescription":true,"description":"*Does not cross filter, use global filters or look at the below visual to look at cross filtered values"},"mark":{"colors":["#077A9D",{"themeColorType":"visualizationColors","position":2},{"themeColorType":"visualizationColors","position":3},{"themeColorType":"visualizationColors","position":4},{"themeColorType":"visualizationColors","position":5},{"themeColorType":"visualizationColors","position":6},{"themeColorType":"visualizationColors","position":7},{"themeColorType":"visualizationColors","position":8},{"themeColorType":"visualizationColors","position":9},{"themeColorType":"visualizationColors","position":10}]}}},"position":{"x":2,"y":6,"width":4,"height":8}},{"widget":{"name":"117de0ec","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"},{"name":"group_key","expression":"`group_key`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage"},"y":{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"hideTitle":true,"title":"Group Key"},"displayName":"Workspace"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key"},"mark":{"colors":["#077A9D",{"themeColorType":"visualizationColors","position":2},{"themeColorType":"visualizationColors","position":3},{"themeColorType":"visualizationColors","position":4},{"themeColorType":"visualizationColors","position":5},{"themeColorType":"visualizationColors","position":6},{"themeColorType":"visualizationColors","position":7},{"themeColorType":"visualizationColors","position":8},{"themeColorType":"visualizationColors","position":9},{"themeColorType":"visualizationColors","position":10}]}}},"position":{"x":0,"y":4,"width":2,"height":10}},{"widget":{"name":"edeb1728","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"time_window_string","expression":"`time_window_string`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"filters":[{"expression":"`usage_type` IN ('Forecast')"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"sum(usage_usd_dynamic)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"bold":true,"color":{"themeColorType":"visualizationColors","position":9},"fontSize":32},"displayName":"Sum of usage_usd_dynamic"},"target":{"fieldName":"time_window_string","style":{"color":{"themeColorType":"fontColor"},"italic":true,"fontSize":14},"displayName":"time_window_string"}},"frame":{"showTitle":true,"title":"Forecasted Usage","showDescription":true,"description":"*Forecast #s do not cross filter, use global filters"}}},"position":{"x":4,"y":2,"width":2,"height":2}},{"widget":{"name":"45326bef","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"time_period","expression":"`time_period`"},{"name":"measure(period_run_rate)","expression":"MEASURE(`period_run_rate`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"measure(period_run_rate)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"fontSize":24},"displayName":"period_run_rate"},"target":{"fieldName":"time_period","style":{"fontSize":18,"color":{"themeColorType":"fontColor"},"italic":true},"displayName":"time_period"}},"frame":{"showTitle":true,"title":"Run Rate Usage","showDescription":true,"description":"(period type)"}}},"position":{"x":2,"y":4,"width":2,"height":2}},{"widget":{"name":"3ead13cd","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"measure(forecast_percent_increase)","expression":"MEASURE(`forecast_percent_increase`)"},{"name":"measure(forecasted_run_rate)","expression":"MEASURE(`forecasted_run_rate`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"measure(forecasted_run_rate)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"fontSize":24},"displayName":"forecasted_run_rate"},"target":{"fieldName":"measure(forecast_percent_increase)","style":{"color":{"themeColorType":"visualizationColors","position":3},"fontSize":20,"rules":[{"condition":{"operator":">=","operand":{"type":"data-value","value":"0.2"}},"color":{"themeColorType":"visualizationColors","position":4}},{"condition":{"operator":">=","operand":{"type":"data-value","value":"0.1"}},"color":{"themeColorType":"visualizationColors","position":2}}]},"format":{"type":"number-percent","decimalPlaces":{"type":"max","places":0}},"displayName":"forecast_percent_increase"}},"frame":{"showTitle":true,"title":"Forecasted Run Rate","showDescription":true,"description":"(percent increase/decrease from actual run rate)"}}},"position":{"x":4,"y":4,"width":2,"height":2}},{"widget":{"name":"68e8b4d4","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"workspace_norm","expression":"`workspace_norm`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"cubeGroupingSets":{"sets":[{"fieldNames":["group_key"]},{"fieldNames":["workspace_norm"]}]},"disaggregated":false,"orders":[{"direction":"ASC","expression":"`group_key`"},{"direction":"ASC","expression":"`workspace_norm`"}]}}],"spec":{"version":3,"widgetType":"pivot","encodings":{"rows":[{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"cell-reversed","field":{"index":0}}},"displayName":"Group Key"}],"columns":[{"fieldName":"workspace_norm","scale":{"type":"categorical","sort":{"by":"cell-reversed","field":{"index":0}}},"displayName":"Workspace"}],"cell":{"type":"multi-cell","fields":[{"fieldName":"sum(usage_usd_dynamic)","cellType":"text","style":{"type":"color-scale","backgroundColor":{"scale":{"type":"quantitative","colorRamp":{"mode":"scheme","scheme":"greenblue"}}}},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"exact","places":2},"hideGroupSeparator":false},"displayName":"Usage"}]}},"frame":{"showTitle":true,"title":"Usage by Workspace and Group Key (export-friendly)"}}},"position":{"x":0,"y":22,"width":6,"height":9}},{"widget":{"name":"838a3112","multilineTextboxSpec":{"lines":["# **Usage Overview**\n","---\n","\n","**Analyze usage for your account by product, workspace, and identify trends over time.**"]}},"position":{"x":0,"y":0,"width":6,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"213392c8","displayName":"Usage Overview - Top N","layout":[{"widget":{"name":"1d94f140","queries":[{"name":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1abab4e68f7a89038b48_param_top_n","query":{"datasetName":"03f6453c","parameters":[{"name":"param_top_n","keyword":"param_top_n"}],"disaggregated":false}},{"name":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1ace912916cfeb25b061_param_top_n","query":{"datasetName":"21de1797","parameters":[{"name":"param_top_n","keyword":"param_top_n"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_top_n","queryName":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1abab4e68f7a89038b48_param_top_n"},{"parameterName":"param_top_n","queryName":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1ace912916cfeb25b061_param_top_n"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Top N"}}},"position":{"x":0,"y":5,"width":1,"height":2}},{"widget":{"name":"c42e90c1","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43100eb776beba94bec7f6_rank_key","query":{"datasetName":"f768db5b","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"rank_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43199e87af012e00363f6b_param_rank_key","query":{"datasetName":"03f6453c","parameters":[{"name":"param_rank_key","keyword":"param_rank_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431a16881bca8766dd4f60_param_rank_key","query":{"datasetName":"21de1797","parameters":[{"name":"param_rank_key","keyword":"param_rank_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"rank_key","displayName":"rank_key","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43100eb776beba94bec7f6_rank_key"},{"parameterName":"param_rank_key","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43199e87af012e00363f6b_param_rank_key"},{"parameterName":"param_rank_key","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431a16881bca8766dd4f60_param_rank_key"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Rank by"}}},"position":{"x":1,"y":5,"width":1,"height":2}},{"widget":{"name":"eeaae9bf","multilineTextboxSpec":{"lines":[" Select `workspace`, `run_as`, or any field from [usage_metadata](https://docs.databricks.com/en/admin/system-tables/billing.html#usage-metadata) to rank the usage. This aggregates the top N usage that has a value for the selected key. For example, selecting 'job_id' will aggregate the usage for the top N jobs. Selecting 'warehouse_id' will aggregate usage by top N warehouses. This is NOT mean to sum up exactly to total usage (as in the Usage Overview tab), as it is a top N analysis by key only, and certain keys can contain multiple SKUs (i.e. a job_id can use JOBS / SQL WAREHOUSES / ALL_PURPOSE compute, etc.)"]}},"position":{"x":0,"y":3,"width":6,"height":2}},{"widget":{"name":"afbd3ae2","queries":[{"name":"main_query","query":{"datasetName":"03f6453c","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"filters":[{"expression":"`rank_key` IN (`rank_key`) OR TRUE"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","axis":{"hideTitle":true},"scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"rank_key","legend":{"position":"right","title":"Top N"},"scale":{"mappings":[{"color":"#ffe4ba","value":""},{"color":"#dedede","value":null},{"value":"","color":"#919191"}],"type":"categorical"},"displayName":"Top N"}},"frame":{"showTitle":true,"title":"Top N Usage by Rank Key Over Time"}}},"position":{"x":0,"y":7,"width":6,"height":8}},{"widget":{"name":"a18a16ab","queries":[{"name":"main_query","query":{"datasetName":"21de1797","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"},{"name":"latest_asset_route","expression":"`latest_asset_route`"}],"filters":[{"expression":"`group_key` IN (`group_key`) OR TRUE"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ latest_asset_route }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"link","visible":true,"order":0,"title":"Top N Billable Objects","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":1,"title":"Usage","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":2,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":9,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":10,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":11,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":12,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"latest_asset_route","type":"string","displayAs":"string","order":13,"title":"latest_asset_route","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"latest_asset_owner","type":"string","displayAs":"string","order":14,"title":"latest_asset_owner","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage By Group Period Over Period"}}},"position":{"x":0,"y":25,"width":6,"height":12}},{"widget":{"name":"79ae85d0","queries":[{"name":"main_query","query":{"datasetName":"03f6453c","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"workspace","expression":"`workspace`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"workspace","axis":{"hideTitle":true},"scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"workspace"},"color":{"fieldName":"rank_key","legend":{"position":"right","title":"Top N"},"scale":{"mappings":[{"color":"#ffe4ba","value":""},{"color":"#dedede","value":null},{"value":"","color":"#919191"}],"type":"categorical"},"displayName":"Top N"}},"frame":{"showTitle":true,"title":"Top N Usage by Rank"}}},"position":{"x":0,"y":15,"width":6,"height":8}},{"widget":{"name":"9334c2b5","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed319be9f1416731ae9ad37_toggle","query":{"datasetName":"bb990f09","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b0a8694ec502e04b822_include_remaining_assets","query":{"datasetName":"03f6453c","parameters":[{"name":"include_remaining_assets","keyword":"include_remaining_assets"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b1f903d9f4747035cc0_include_remaining_assets","query":{"datasetName":"21de1797","parameters":[{"name":"include_remaining_assets","keyword":"include_remaining_assets"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed319be9f1416731ae9ad37_toggle"},{"parameterName":"include_remaining_assets","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b0a8694ec502e04b822_include_remaining_assets"},{"parameterName":"include_remaining_assets","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b1f903d9f4747035cc0_include_remaining_assets"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"No"}]}}},"frame":{"showTitle":true,"title":"Include Remaining Billable Objects"}}},"position":{"x":2,"y":5,"width":1,"height":2}},{"widget":{"name":"9648b6b6","multilineTextboxSpec":{"lines":[" !Billable Object Hyperlinks! If hyperlinks are enabled (in the global filters), the user can click on most Billable Object Ids to go to that object. To do this, the user MUST have read/access permission to the underlying asset. This is best used with workspace admins."]}},"position":{"x":0,"y":23,"width":6,"height":2}},{"widget":{"name":"e063fd58","multilineTextboxSpec":{"lines":["# **Usage Overview: Top N Usage By Key**\n","---\n","\n","**Quickly identify top N drivers of usage across your account**\n","---\n"," This section ranks Top N usage by any selected billable object such as job_id, warehouse_id, cluster_id, endpoint_id, etc. This helps narrow down specific top drivers of cost for a particular product area. i.e. 'Show me the top 10 job_ids that are driving my spend on JOBS compute'."]}},"position":{"x":0,"y":0,"width":6,"height":3}},{"widget":{"name":"4731089e","multilineTextboxSpec":{"lines":[" The 'Include Remaining Billable Objects' filter allows you to show or not show the aggregated usage outside of the top N objects. If 'Yes' is selected, you will the the top 10 objects as well as a single category of aggregated usage for all remaining objects that are not in the top N. I you select top 10 by 'warehouse_id' then you will see the top 10 warehouses as well as a single bucket called 'REMANING OBJECTS' that is the total usage for all remaining warehouses. "]}},"position":{"x":3,"y":5,"width":3,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"096c54ee","displayName":"Usage Analysis - Tag Matching","layout":[{"widget":{"name":"bd6547ea","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries","query":{"datasetName":"437db86b","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries","query":{"datasetName":"450b2674","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Tag search filter","description":"; separated list of key=value pairs to search, with values as optional (eg: env=prod;budget)"}}},"position":{"x":0,"y":4,"width":2,"height":2}},{"widget":{"name":"7fe3bdc0","queries":[{"name":"dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a9018d89d75c7fb3990c860_toggle","query":{"datasetName":"cd4e3c97","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901a779a1f582d5744be5f_param_show_tag_mismatch","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901abf9e8cee0ddb71ef55_param_show_tag_mismatch","query":{"datasetName":"437db86b","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901af096142371b0cec5f2_param_show_tag_mismatch","query":{"datasetName":"450b2674","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a9018d89d75c7fb3990c860_toggle"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901a779a1f582d5744be5f_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901abf9e8cee0ddb71ef55_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901af096142371b0cec5f2_param_show_tag_mismatch"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Usage Match Filter","description":"show all, matched, or only unmatched usage"}}},"position":{"x":2,"y":4,"width":1,"height":2}},{"widget":{"name":"f57c064d","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","axis":{"hideTitle":true},"scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage ($)"},"color":{"fieldName":"group_key","legend":{"position":"bottom","title":"Tag Key-Value Pairs","hideTitle":true},"scale":{"mappings":[{"value":"","color":"#AB4057"},{"value":"","color":"#077A9D"},{"value":"","color":"#00A972"},{"value":"Photon","color":"#00A972"},{"value":"Spark","color":"#077A9D"},{"value":"","color":"#AB4057"},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}],"type":"categorical"},"displayName":"Tags"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key Over Time"}}},"position":{"x":2,"y":12,"width":4,"height":8}},{"widget":{"name":"d817ee65","queries":[{"name":"main_query","query":{"datasetName":"437db86b","fields":[{"name":"group_key_html","expression":"`group_key_html`"},{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Tags","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":0,"displayName":"group_key_html"},{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":false,"order":1,"title":"Tag Key-Value Pairs","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":2,"title":"Start to End date","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":9,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":3,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":10,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":11,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":12,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":13,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage by Group Period Over Period (*Note: does not cross filter with above visuals - use top filters*)"}}},"position":{"x":0,"y":30,"width":6,"height":11}},{"widget":{"name":"dbdc3a3d","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"IsMatchedClean","expression":"`IsMatchedClean`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"title":"Is Search Match?","hideTitle":true},"displayName":"Is Matched?"},"color":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","mappings":[{"value":"","color":"#077A9D"},{"value":"","color":"#AB4057"}]},"legend":{"hide":true,"hideTitle":true},"displayName":"IsMatchedClean"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Tag Match"}}},"position":{"x":0,"y":6,"width":2,"height":6}},{"widget":{"name":"1d3b9e4e","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"IsMatchedClean","expression":"`IsMatchedClean`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"group_key","expression":"`group_key`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Usage"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage"},"y":{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"labelAngle":90,"hideTitle":true},"displayName":"BIlling Origin Product"},"color":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","mappings":[{"value":"","color":"#00A972"},{"value":"","color":"#AB4057"},{"value":"","color":"#077A9D"},{"value":"","color":"#AB4057"},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hide":false,"hideTitle":true},"displayName":"IsMatchedClean"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key"}}},"position":{"x":0,"y":12,"width":2,"height":8}},{"widget":{"name":"93d10194","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"billing_origin_product","expression":"`billing_origin_product`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"billing_origin_product","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Product"},"color":{"fieldName":"group_key","scale":{"type":"categorical","mappings":[{"value":"","color":{"themeColorType":"visualizationColors","position":6}},{"value":"","color":{"themeColorType":"visualizationColors","position":1}},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hideTitle":true},"displayName":"Product"}},"frame":{"showTitle":true,"title":"Usage by Product & Group Key"}}},"position":{"x":0,"y":20,"width":3,"height":10}},{"widget":{"name":"a50cc13a","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4310d2a7469a2dbfb64560_group_key","query":{"datasetName":"988516d6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"group_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_tag_group","query":{"datasetName":"d61a4eeb","parameters":[{"name":"tag_group","keyword":"tag_group"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_tag_group","query":{"datasetName":"437db86b","parameters":[{"name":"tag_group","keyword":"tag_group"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"group_key","displayName":"group_key","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4310d2a7469a2dbfb64560_group_key"},{"parameterName":"tag_group","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_tag_group"},{"parameterName":"tag_group","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_tag_group"}]},"frame":{"showTitle":true,"title":"Group by"}}},"position":{"x":3,"y":4,"width":2,"height":2}},{"widget":{"name":"e90d7185","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"time_key","expression":"`time_key`"},{"name":"avg(tag_match_rate)","expression":"AVG(`tag_match_rate`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"line","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"axis":{"hideTitle":true},"displayName":"time_key"},"y":{"fieldName":"avg(tag_match_rate)","scale":{"type":"quantitative"},"format":{"type":"number-percent","decimalPlaces":{"type":"max","places":3}},"axis":{"title":"Match Rate"},"displayName":"Match Rate"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Tag Match Rate Over Time"}}},"position":{"x":2,"y":6,"width":4,"height":6}},{"widget":{"name":"e421ac73","multilineTextboxSpec":{"lines":["## Tag Popularity\n","-----\n","\n"," This section shows what the most commonly used tags are to aid in searching. Tag Popularity is based on the % of usage that is tagged. The more popular a tag is, the more usage $ that tag will cover. This section is NOT additive by usage, as usage records can have multiple tags per record. \n","-----"]}},"position":{"x":0,"y":41,"width":6,"height":3}},{"widget":{"name":"9be1cda1","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431bc29d7355e147d8ef25_toggle","query":{"datasetName":"8b6b5367","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_tag_aggregate_by","query":{"datasetName":"a28f5b19","parameters":[{"name":"top_tag_aggregate_by","keyword":"top_tag_aggregate_by"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_tag_aggregate_by","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_tag_aggregate_by"},{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431bc29d7355e147d8ef25_toggle"}]},"frame":{"showTitle":true,"title":"Rank Top N Tags By"}}},"position":{"x":2,"y":44,"width":2,"height":2}},{"widget":{"name":"c4d3593b","queries":[{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_n_tags","query":{"datasetName":"a28f5b19","parameters":[{"name":"top_n_tags","keyword":"top_n_tags"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_n_tags","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_n_tags"}]},"frame":{"showTitle":true,"title":"Top N Tag Number"}}},"position":{"x":4,"y":44,"width":2,"height":2}},{"widget":{"name":"4838e10f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Popularity"},"displayName":"Usage"},"color":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical"},"displayName":"Tag"}},"mark":{"layout":"percent-stack"}}},"position":{"x":2,"y":46,"width":4,"height":8}},{"widget":{"name":"4d9bf13f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"workspace","expression":"`workspace`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"displayName":"Popularity"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"workspace","scale":{"type":"categorical"},"legend":{"position":"bottom"},"displayName":"Workspace"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Top Tags Used By Workspace"}}},"position":{"x":3,"y":54,"width":3,"height":9}},{"widget":{"name":"b16984be","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"displayName":"Popularity"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"billing_origin_product","scale":{"type":"categorical"},"legend":{"position":"bottom"},"displayName":"Product"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Top Tags Used By Product"}}},"position":{"x":0,"y":54,"width":3,"height":9}},{"widget":{"name":"0fd2c4d0","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43111497b24acee72ebf13_toggle","query":{"datasetName":"2b5e3641","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_normalize_case","query":{"datasetName":"d61a4eeb","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_normalize_case","query":{"datasetName":"437db86b","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_normalize_case","query":{"datasetName":"450b2674","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_normalize_case","query":{"datasetName":"a28f5b19","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43111497b24acee72ebf13_toggle"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_normalize_case"}]},"frame":{"showDescription":true,"showTitle":true,"title":"Normalize Tags?","description":"Cleans spaces & casing"}}},"position":{"x":5,"y":4,"width":1,"height":2}},{"widget":{"name":"9d07a1ad","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"workspace_id","expression":"`workspace_id`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"workspace_id","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Workspace"},"color":{"fieldName":"group_key","scale":{"type":"categorical","mappings":[{"value":"","color":{"themeColorType":"visualizationColors","position":6}},{"value":"","color":{"themeColorType":"visualizationColors","position":1}},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hideTitle":true},"displayName":"Product"}},"frame":{"showTitle":true,"title":"Usage by Workspace & Group Key"}}},"position":{"x":3,"y":20,"width":3,"height":10}},{"widget":{"name":"d018a853","multilineTextboxSpec":{"lines":["# **Usage Analysis: Tag Matching**\n","---\n","\n","**Analyze usage with your own tagging policies. Select tags to identify usage that matches (or doesnt match) those tags, and trend over time by tag.**"]}},"position":{"x":0,"y":0,"width":6,"height":2}},{"widget":{"name":"c466a6a0","multilineTextboxSpec":{"lines":[" When you search for a set of tags in the search bar, all usage will be classified into 'NOT TAGGED', 'NO TAG MATCH', or 'MATCHED'. \n"," - **NOT TAGGED** - means the usage is not tagged at all, which by default will never match a tag search. \n","- **NO TAG MATCH** - means the usage is tagged, but not with the tags you are searching on\n","- **MATCHED** - means that usage includes all tags you are searching on"]}},"position":{"x":0,"y":2,"width":6,"height":2}},{"widget":{"name":"a7579c4f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Popularity By Usage"},"displayName":"Usage"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical"},"displayName":"Tag"}},"frame":{"showTitle":true,"title":"Top N Tags By Popularity"},"mark":{"layout":"stack"}}},"position":{"x":0,"y":44,"width":2,"height":10}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"e94f9247","displayName":"Usage Analysis - Top Objects","layout":[{"widget":{"name":"7c65e880","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_asset_id","query":{"datasetName":"450b2674","fields":[{"name":"asset_id","expression":"`asset_id`"},{"name":"asset_id_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"asset_id","displayName":"asset_id","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_asset_id"}]},"frame":{"showTitle":true,"title":"Billable Object Id"}}},"position":{"x":2,"y":5,"width":2,"height":2}},{"widget":{"name":"fc3ff2e9","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_usage_owner","query":{"datasetName":"450b2674","fields":[{"name":"usage_owner","expression":"`usage_owner`"},{"name":"usage_owner_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"usage_owner","displayName":"usage_owner","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_usage_owner"}]},"frame":{"showTitle":true,"title":"Billable Object User"}}},"position":{"x":4,"y":5,"width":2,"height":2}},{"widget":{"name":"454d51c4","queries":[{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_top_n_asset","query":{"datasetName":"450b2674","parameters":[{"name":"top_n_asset","keyword":"top_n_asset"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_n_asset","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_top_n_asset"}]},"frame":{"showTitle":true,"title":"Top N Billable Object Ids","showDescription":true,"description":"Filter for Top N assets"}}},"position":{"x":0,"y":3,"width":1,"height":2}},{"widget":{"name":"22a280b4","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_DaysSinceMostRecentUsage","query":{"datasetName":"450b2674","fields":[{"name":"min(DaysSinceMostRecentUsage)","expression":"MIN(`DaysSinceMostRecentUsage`)"},{"name":"max(DaysSinceMostRecentUsage)","expression":"MAX(`DaysSinceMostRecentUsage`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"range-slider","encodings":{"fields":[{"fieldName":"DaysSinceMostRecentUsage","displayName":"DaysSinceMostRecentUsage","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_DaysSinceMostRecentUsage"}]},"selection":{"defaultSelection":{"range":{"dataType":"INTEGER","min":{"value":""},"max":{"value":"30"}}}},"frame":{"showTitle":true,"title":"Days Since Last Usage","showDescription":true,"description":"Filter out assets that are no longer used recently"}}},"position":{"x":0,"y":5,"width":2,"height":2}},{"widget":{"name":"2e0ec97a","queries":[{"name":"main_query","query":{"datasetName":"450b2674","fields":[{"name":"MatchedKey_html","expression":"`MatchedKey_html`"},{"name":"MostRecentIsMatched","expression":"`MostRecentIsMatched`"},{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"asset_id","expression":"`asset_id`"},{"name":"MostRecentAssetName","expression":"`MostRecentAssetName`"},{"name":"is_object_deleted","expression":"`is_object_deleted`"},{"name":"usage_dollars_html","expression":"`usage_dollars_html`"},{"name":"percent_pop_change","expression":"`percent_pop_change`"},{"name":"heat_color_html","expression":"`heat_color_html`"},{"name":"workspace_id","expression":"`workspace_id`"},{"name":"MostRecentUsageDate","expression":"`MostRecentUsageDate`"},{"name":"usage_owner","expression":"`usage_owner`"},{"name":"EarliestUsageDate","expression":"`EarliestUsageDate`"},{"name":"MostRecentTagsOnAsset","expression":"`MostRecentTagsOnAsset`"},{"name":"MostRecentUsageMetadata","expression":"`MostRecentUsageMetadata`"},{"name":"MostRecentProductFeatures","expression":"`MostRecentProductFeatures`"},{"name":"usage_type","expression":"`usage_type`"},{"name":"asset_url_router","expression":"`asset_url_router`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"MatchedKey_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Is Matched","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Is most recent usage of this asset matching the search pattern","defaultColumnWidth":130,"displayName":"MatchedKey_html"},{"fieldName":"MostRecentIsMatched","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":false,"order":1,"title":"Is Matched","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Is the Most recent usage of this asset correctly matched?","displayName":"MostRecentIsMatched"},{"fieldName":"billing_origin_product","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Product","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":150,"displayName":"billing_origin_product"},{"fieldName":"asset_id","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ asset_url_router }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"link","visible":true,"order":4,"title":"Billable Object Id","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"The id of a cluster, job, warehouse, pipeline, etc. that the usage originates from","cellFormat":{"default":{"foregroundColor":null},"rules":[]},"defaultColumnWidth":200,"displayName":"asset_id"},{"fieldName":"MostRecentAssetName","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"Object Name","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Name of cluster or warehouse from system.compute/jobs","defaultColumnWidth":150,"displayName":"MostRecentAssetName"},{"fieldName":"is_object_deleted","numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"Is Deleted?","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"This works for jobs, warehouses, clusters, and pipelines only. ","cellFormat":{"default":{"foregroundColor":{"themeColorType":"visualizationColors","position":5}},"rules":[{"if":{"column":"is_object_deleted","fn":"=","literal":"active"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":7}}},{"if":{"column":"is_object_deleted","fn":"=","literal":"deleted"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":6}}},{"if":{"column":"is_object_deleted","fn":"=","literal":"unknown"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":9}}}]},"defaultColumnWidth":140,"displayName":"is_object_deleted"},{"fieldName":"usage_dollars_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"Usage $","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":200,"displayName":"usage_dollars_html"},{"fieldName":"percent_pop_change","numberFormat":"%","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"decimal","displayAs":"number","visible":true,"order":10,"title":"% Change Since Last Period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"% change since last period","cellFormat":{"default":{"foregroundColor":null},"rules":[{"if":{"column":"percent_pop_change","fn":">=","literal":"0"},"value":{"foregroundColor":"#00A972"}},{"if":{"column":"percent_pop_change","fn":"<","literal":"0"},"value":{"foregroundColor":"#FF3621"}}]},"displayName":"percent_pop_change"},{"fieldName":"heat_color_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":11,"title":"Days Since Last Usage","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":201,"displayName":"heat_color_html"},{"fieldName":"workspace_id","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":13,"title":"Workspace Id","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"workspace_id"},{"fieldName":"MostRecentUsageDate","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"date","displayAs":"datetime","visible":true,"order":14,"title":"Most Recent Usage Date","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentUsageDate"},{"fieldName":"usage_owner","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":17,"title":"Object Runner / Owner","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_owner"},{"fieldName":"EarliestUsageDate","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"date","displayAs":"datetime","visible":true,"order":19,"title":"Earliest Usage Date","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"EarliestUsageDate"},{"fieldName":"MostRecentTagsOnAsset","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":20,"title":"Most Recent Tags","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentTagsOnAsset"},{"fieldName":"MostRecentUsageMetadata","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":21,"title":"Most Recent Usage Metadata","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentUsageMetadata"},{"fieldName":"MostRecentProductFeatures","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":22,"title":"Most Recent Product Features","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentProductFeatures"},{"fieldName":"usage_type","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":24,"title":"usage_type","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_type"}]},"invisibleColumns":[{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"MostRecentTagKeyValuePairs","type":"string","displayAs":"string","order":2,"title":"MostRecentTagKeyValuePairs","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"asset_type","type":"string","displayAs":"string","order":7,"title":"Object Type","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"$ ,0.","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"TotalDollarsUsage","type":"decimal","displayAs":"number","order":9,"title":"Usage ($)","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"cellFormat":{"default":{"foregroundColor":null},"rules":[]}},{"numberFormat":",.","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"TotalDBUUsageQuantity","type":"decimal","displayAs":"number","order":12,"title":"Usage (DBUs)","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"DaysSinceMostRecentUsage","type":"integer","displayAs":"number","order":15,"title":"Days Since Last Use","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"asset_url_router","type":"string","displayAs":"string","order":16,"title":"asset_url_router","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"IsClassifiedIntoAsset","type":"string","displayAs":"string","order":18,"title":"IsClassifiedIntoAsset","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"clean_ui_is_matched","type":"string","displayAs":"string","order":23,"title":"clean_ui_is_matched","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage_dollars","type":"decimal","displayAs":"number","order":25,"title":"max_usage_dollars","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage_dollars","type":"decimal","displayAs":"number","order":26,"title":"min_usage_dollars","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage_days","type":"integer","displayAs":"number","order":27,"title":"max_usage_days","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage_days","type":"integer","displayAs":"number","order":28,"title":"min_usage_days","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"IsServerless","type":"string","displayAs":"string","order":29,"title":"IsServerless","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"dateTimeFormat":"YYYY-MM-DD HH:mm:ss.SSS","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"current_period","type":"datetime","displayAs":"datetime","order":30,"title":"current_period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"dateTimeFormat":"YYYY-MM-DD HH:mm:ss.SSS","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"last_period","type":"datetime","displayAs":"datetime","order":31,"title":"last_period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"current_period_usage_usd","type":"decimal","displayAs":"number","order":32,"title":"current_period_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"last_period_usage_usd","type":"decimal","displayAs":"number","order":33,"title":"last_period_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"top_n_asset","type":"integer","displayAs":"number","order":34,"title":"top_n_asset","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":25,"paginationSize":"default","condensed":true,"withRowNumber":false,"frame":{"showTitle":true,"title":"Tag SKU Item Level Details","showDescription":true,"description":"Detailed list to find and go to specific clusters, jobs, warehouses, pipelines, etc. assets to identify tagging and resolve. This can be used to click the Asset Id to go directly to the asset, tag, and fix tags. "}}},"position":{"x":0,"y":17,"width":6,"height":20}},{"widget":{"name":"42258495","queries":[{"name":"main_query","query":{"datasetName":"450b2674","fields":[{"name":"sum(TotalDollarsUsage)","expression":"SUM(`TotalDollarsUsage`)"},{"name":"workspace_id","expression":"`workspace_id`"},{"name":"billing_origin_product","expression":"`billing_origin_product`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"heatmap","encodings":{"x":{"fieldName":"workspace_id","scale":{"type":"categorical"},"axis":{"hideTitle":true},"displayName":"Workspace"},"y":{"fieldName":"billing_origin_product","scale":{"type":"categorical"},"axis":{"hideTitle":true},"displayName":"Product"},"color":{"fieldName":"sum(TotalDollarsUsage)","scale":{"type":"quantitative","colorRamp":{"mode":"scheme","scheme":"redyellowgreen"},"reverse":true},"displayName":"Usage ($)"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Workspace & Product"}}},"position":{"x":0,"y":7,"width":6,"height":8}},{"widget":{"name":"1128d02c","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries","query":{"datasetName":"437db86b","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries","query":{"datasetName":"450b2674","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Tag search filter","description":"; separated list of key=value pairs to search, with values as optional (eg: env=prod;budget)"}}},"position":{"x":1,"y":3,"width":3,"height":2}},{"widget":{"name":"195e780d","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb421eb8be1e6c0b38b58760_toggle","query":{"datasetName":"cd4e3c97","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_param_show_tag_mismatch","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_param_show_tag_mismatch","query":{"datasetName":"437db86b","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_param_show_tag_mismatch","query":{"datasetName":"450b2674","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb421eb8be1e6c0b38b58760_toggle"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_param_show_tag_mismatch"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Usage Match Filter","description":"show all, matched, or only unmatched usage"}}},"position":{"x":4,"y":3,"width":1,"height":2}},{"widget":{"name":"e255ef0d","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171ba59f30ebbe82f043af_toggle","query":{"datasetName":"2b5e3641","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_normalize_case","query":{"datasetName":"d61a4eeb","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_normalize_case","query":{"datasetName":"437db86b","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_normalize_case","query":{"datasetName":"450b2674","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_normalize_case","query":{"datasetName":"a28f5b19","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171ba59f30ebbe82f043af_toggle"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_normalize_case"}]},"frame":{"showDescription":true,"showTitle":true,"title":"Normalize Tags?","description":"Cleans spaces & casing for more robust tag matching"}}},"position":{"x":5,"y":3,"width":1,"height":2}},{"widget":{"name":"d25959e3","multilineTextboxSpec":{"lines":[" !Billable Object Hyperlinks! If hyperlinks are enabled (in the global filters), the user can click on most Billable Object Ids to go to that object. To do this, the user MUST have read/access permission to the underlying asset. This is best used with workspace admins."]}},"position":{"x":0,"y":15,"width":6,"height":2}},{"widget":{"name":"be725a9f","multilineTextboxSpec":{"lines":["# **Usage Analysis: Top Billable Objects**\n","---\n","\n","Combine tag-based analysis to drill down to specific objects that are driving usage. Find objects (i.e. a job, a warehouse, etc.) that are driving usage and click into them to take action."]}},"position":{"x":0,"y":0,"width":6,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"c7aaecc0","displayName":"README","layout":[{"widget":{"name":"4e9d169a","multilineTextboxSpec":{"lines":["### Release Notes for Version: 2\n","\n","##### New Features: \n","1. Added data bars to table visuals for easier reading\n","2. Added \"normalization\" flag to tag matching to optionally lowercase and trim tag key-value searches and aggregate usage by cleaned-up values\n","3. Added \"Usage Analysis\" Section - Allows users to identify tagged and mistagged usage by SKU/Workspace/ and Asset Id (job_id, cluster_id, sql warehouse, etc. from usage_metadata) Provides a detailed clickable set of results to more easily find and fix mis-tagged usage. \n","4. Re-ordered matrix period columns from most recent to oldest\n","5. Added SKU + workspace filters to tag detailed section\n","6. Added tag classification distinction between UNTAGGED and NO TAG MATCH\n","7. Separated sections into dashboard tabs\n","8. Added clickable links to identified assets\n","9. Added usage recency fields by asset id to identify recent fixes and asset usage relevance\n","10. Added optional discounts parameter by SKU category to see usage by discounts (temp fix until discounts system table)\n","11. Added optional \"group agg\" mode in tag analysis section to allow users to choose to display tag results by key-value pairs or only keys. \n","12. Added Global Filters for simpler cross-tab navigation\n","13. Added Preview features for AI_FORECAST\n","14. Added Preview feature for account_prices tables\n","15. Added Global Filters Panel to filter all tabs at once\n","16. Added Preview Feature Toggle Flags in Global Filters"]}},"position":{"x":0,"y":16,"width":6,"height":8}},{"widget":{"name":"286af4cc","multilineTextboxSpec":{"lines":["# README: Databricks Usage Dashboard v2.0\n","---- \n","### Overview\n","This is version 2.0 of the popular [Usage Dashboard](https://docs.databricks.com/aws/en/admin/account-settings/usage), which provides users granular visibility into all billable usage across their Databricks account. \n","\n","*Note: This dashboard is not yet officially supported by Databricks, and still in preview. New updates to this version of the dashboard may be periodically released.*\n","\n","----\n","Version 2.0 comes with a series of advanced functionality that leverages the best of new AI/BI Dashboard features.\n","\n","This dashboard helps answer:\n","\n","**Total actual and forecasted spend**\n","- What is total spend across your account? By workspace? By product?\n","- What is the forecasted total spend?\n","\n","**Top spend drivers**\n","- What are the top 10 objects, by cost, in your account?\n","- Who owns the top objects, by cost, that match a certain tag? In which workspaces are they located?\n","\n","**Spend breakdown by tags**\n","- What are the most popular tags (key, value pairs) in your account?\n","- What is the total spend tagged by specific key, value pairs?\n","\n","### Data sources\n","The dashboard is built on top of the following system tables:\n","- [system.billing.usage](https://docs.databricks.com/en/admin/system-tables/billing.html)\n","- [system.access.workspaces_latest](https://docs.databricks.com/en/admin/system-tables/billing.html),\n","- [system.billing.list_prices](https://docs.databricks.com/en/admin/system-tables/pricing.html)\n","- [system.compute.clusters](https://docs.databricks.com/aws/en/admin/system-tables/compute)\n","- [system.compute.warehouses](https://docs.databricks.com/aws/en/admin/system-tables/warehouses)\n","- [system.lakeflow.jobs](https://docs.databricks.com/aws/en/admin/system-tables/jobs#jobs)\n","- [system.lakeflow.pipelines](https://docs.databricks.com/aws/en/admin/system-tables/jobs#pipelines)\n","- [system.access.clean_room_events](https://docs.databricks.com/aws/en/admin/system-tables/clean-rooms)\n","- [system.serving.served_entities](https://docs.databricks.com/aws/en/ai-gateway/configure-ai-gateway-endpoints#usage-schema).\n","\n","Users must have **SELECT** access to the above system tables in order to use the dashboard. \n","\n","#### Installation Instructions\n","\n","Users can then easily [import the JSON Dashboard File](https://docs.databricks.com/aws/en/dashboards/#import-a-dashboard-file) into their workspace of choice to load the dashboard. \n","Note on prerequisites: User should have system table access to view the dashboard.\n","\n","\n","#### Support\n","Soon, this dashboard will be accessible directly in the product, like the current Usage Dashboard in PuPr. Admins can locate and import the dashboard directly from the Account Console in a few clicks. \n","\n","In the meantime, we are collecting feedback on the usability and performance of Usage Dashboard v2.0. Please share any feedback with your account team or Sadhana Bala directly. We appreciate you testing out this feature early!\n","\n"]}},"position":{"x":0,"y":0,"width":6,"height":16}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"c57685b8","displayName":"Global Filters","layout":[{"widget":{"name":"d8bb3581","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_time_range","query":{"datasetName":"6b9e03f6","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_time_range","query":{"datasetName":"e1dac524","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_time_range","query":{"datasetName":"f14c46e1","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_time_range","query":{"datasetName":"a28f5b19","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_time_range","query":{"datasetName":"d61a4eeb","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_time_range","query":{"datasetName":"437db86b","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_time_range","query":{"datasetName":"450b2674","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_time_range","query":{"datasetName":"03f6453c","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_time_range","query":{"datasetName":"21de1797","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308139e94f02254115fc7db_time_range","query":{"datasetName":"c93a48f4","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_time_range","query":{"datasetName":"f768db5b","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-date-range-picker","encodings":{"fields":[{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308139e94f02254115fc7db_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_time_range"}]},"selection":{"defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-90d/d"},"max":{"value":"now/d"}}}},"frame":{"showTitle":true,"title":"Time Window"}}},"position":{"x":0,"y":0,"width":1,"height":2}},{"widget":{"name":"e78d2abf","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171a368e1ed883be16485e_workspace_full_name","query":{"datasetName":"1c899adf","fields":[{"name":"workspace_full_name","expression":"`workspace_full_name`"},{"name":"workspace_full_name_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171aa8a4e00132df0ee996_param_workspace","query":{"datasetName":"f768db5b","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_param_workspace","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_param_workspace","query":{"datasetName":"e1dac524","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_param_workspace","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_param_workspace","query":{"datasetName":"a28f5b19","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_param_workspace","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_param_workspace","query":{"datasetName":"437db86b","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_param_workspace","query":{"datasetName":"450b2674","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_param_workspace","query":{"datasetName":"03f6453c","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_param_workspace","query":{"datasetName":"21de1797","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"workspace_full_name","displayName":"workspace_full_name","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171a368e1ed883be16485e_workspace_full_name"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171aa8a4e00132df0ee996_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_param_workspace"}]},"frame":{"showTitle":true,"title":"Workspace"}}},"position":{"x":0,"y":2,"width":1,"height":2}},{"widget":{"name":"287c4580","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813c9b737eb053157a652_billing_origin_product","query":{"datasetName":"a5da9d48","fields":[{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"billing_origin_product_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_product_category","query":{"datasetName":"f768db5b","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_product_category","query":{"datasetName":"6b9e03f6","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_product_category","query":{"datasetName":"e1dac524","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_product_category","query":{"datasetName":"f14c46e1","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_product_category","query":{"datasetName":"a28f5b19","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_product_category","query":{"datasetName":"d61a4eeb","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_product_category","query":{"datasetName":"437db86b","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_product_category","query":{"datasetName":"450b2674","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_product_category","query":{"datasetName":"03f6453c","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_product_category","query":{"datasetName":"21de1797","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"billing_origin_product","displayName":"billing_origin_product","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813c9b737eb053157a652_billing_origin_product"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_product_category"}]},"frame":{"showTitle":true,"title":"Billing Origin Product"}}},"position":{"x":0,"y":4,"width":1,"height":2}},{"widget":{"name":"9b4cc701","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308137f9dbffcbb0a0ed012_time_key","query":{"datasetName":"2733d12f","fields":[{"name":"time_key","expression":"`time_key`"},{"name":"time_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_time_key","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_time_key","query":{"datasetName":"e1dac524","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_time_key","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_param_time_key","query":{"datasetName":"a28f5b19","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_time_key","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_time_key","query":{"datasetName":"437db86b","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_time_key","query":{"datasetName":"450b2674","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_param_time_key","query":{"datasetName":"03f6453c","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_param_time_key","query":{"datasetName":"21de1797","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"time_key","displayName":"time_key","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308137f9dbffcbb0a0ed012_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_param_time_key"}]},"frame":{"showTitle":true,"title":"Dates by"},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Day"}]}}}}},"position":{"x":0,"y":6,"width":1,"height":2}},{"widget":{"name":"1aff4d16","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_discounts_by_product","query":{"datasetName":"6b9e03f6","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_discounts_by_product","query":{"datasetName":"e1dac524","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_discounts_by_product","query":{"datasetName":"f14c46e1","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_discounts_by_product","query":{"datasetName":"a28f5b19","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_discounts_by_product","query":{"datasetName":"d61a4eeb","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_discounts_by_product","query":{"datasetName":"437db86b","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_discounts_by_product","query":{"datasetName":"450b2674","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_discounts_by_product","query":{"datasetName":"03f6453c","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_discounts_by_product","query":{"datasetName":"21de1797","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_discounts_by_product"}]},"frame":{"showTitle":true,"title":"Discount Overrides","showDescription":true,"description":"; separated list of Billing Origin Product -level or SKU discounts that override list or account prices system table. For example, set SQL=0.1 for a 10% discount on all SQL SKUs. You can also set a global discount override by setting the filter to be *=0.X. For example, set *=0.1 for a global 10% discount across your account. "},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}}}},"position":{"x":0,"y":10,"width":1,"height":2}},{"widget":{"name":"2c49184f","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bc18fa9a7dd7016dfe7_toggle","query":{"datasetName":"17558292","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_forecast_toggle","query":{"datasetName":"e1dac524","parameters":[{"name":"forecast_toggle","keyword":"forecast_toggle"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bc18fa9a7dd7016dfe7_toggle"},{"parameterName":"forecast_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_forecast_toggle"}]},"frame":{"showTitle":true,"title":"Preview - Forecast (PubPr)","showDescription":true,"description":"Use AI_FORECAST to project usage in the Usage Overview tab using the global time grain"}}},"position":{"x":0,"y":12,"width":1,"height":2}},{"widget":{"name":"08881129","queries":[{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_units_to_predict","query":{"datasetName":"e1dac524","parameters":[{"name":"units_to_predict","keyword":"units_to_predict"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"units_to_predict","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_units_to_predict"}]},"frame":{"showTitle":true,"title":"Preview - Forecast Horizon (PubPr)","showDescription":true,"description":"Number of time units to forecast based on selected time grain"}}},"position":{"x":0,"y":14,"width":1,"height":2}},{"widget":{"name":"d8f4bae4","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bdcb543a70579c213f8_toggle","query":{"datasetName":"1100555f","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_price_table","query":{"datasetName":"6b9e03f6","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_price_table","query":{"datasetName":"e1dac524","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_price_table","query":{"datasetName":"f14c46e1","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_price_table","query":{"datasetName":"a28f5b19","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_price_table","query":{"datasetName":"d61a4eeb","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_price_table","query":{"datasetName":"437db86b","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_price_table","query":{"datasetName":"450b2674","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_price_table","query":{"datasetName":"03f6453c","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_price_table","query":{"datasetName":"21de1797","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bdcb543a70579c213f8_toggle"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_price_table"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},"frame":{"showTitle":true,"title":"Preview - Price Table (PrPr)","showDescription":true,"description":"list_prices or account_prices"}}},"position":{"x":0,"y":16,"width":1,"height":2}},{"widget":{"name":"c6b2a220","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f03d69eff513559ada28939fe25356_toggle","query":{"datasetName":"eb3d55f9","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_enable_links_toggle","query":{"datasetName":"450b2674","parameters":[{"name":"enable_links_toggle","keyword":"enable_links_toggle"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_enable_links_toggle","query":{"datasetName":"21de1797","parameters":[{"name":"enable_links_toggle","keyword":"enable_links_toggle"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f03d69eff513559ada28939fe25356_toggle"},{"parameterName":"enable_links_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_enable_links_toggle"},{"parameterName":"enable_links_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_enable_links_toggle"}]},"frame":{"showTitle":true,"title":"Preview - Billing Object Links (PrPr)"}}},"position":{"x":0,"y":18,"width":1,"height":2}}],"pageType":"PAGE_TYPE_GLOBAL_FILTERS"}],"uiSettings":{"theme":{"widgetHeaderAlignment":"ALIGNMENT_UNSPECIFIED"}}} \ No newline at end of file +{"datasets":[{"name":"cd4e3c97","displayName":"select_yes_no_tag_show_mismatch","queryLines":["select explode(array(\n"," 'Not Matched Only',\n"," 'Matched Only',\n"," 'All Usage'\n",")) as toggle"]},{"name":"46222f11","displayName":"select_dbus_dollars_toggle","queryLines":["select explode(array(\n"," 'DBUs',\n"," 'Dollars'\n",")) as toggle"]},{"name":"2733d12f","displayName":"select_time_key_overview","queryLines":["select explode(array(\n"," 'Day',\n"," 'Week',\n"," 'Month',\n"," 'Quarter',\n"," 'Year'\n",")) as time_key"]},{"name":"078fbf24","displayName":"select_group_key","queryLines":["select explode(array(\n"," 'Workspace',\n"," 'Product',\n"," 'SKU'\n"," --'Photon',\n"," --'Serverless'\n",")) as group_key"]},{"name":"1c899adf","displayName":"select_workspace","queryLines":["with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n",")\n","\n","SELECt DISTINCT workspace_full_name from workspace"]},{"name":"c93a48f4","displayName":"select_tag_key","queryLines":["with\n","-- parse workspaces json\n","workspace as (\n"," select explode(\n"," map_entries(from_json('$$$__WORKSPACES_JSON__$$$', 'map'))\n"," ) as kvp,\n"," kvp['key'] as workspace_id,\n"," kvp['value'] as workspace_name\n","),\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else concat(workspace_name, ' (id: ', u.workspace_id, ')')\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," left join workspace\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *\n"," from usage_with_ws_filtered_by_date\n"," where if(:param_workspace='', true, workspace = :param_workspace) -- all workspaces under account, or single workspace\n","),\n","-- query\n","tag_key_selection as (\n"," select\n"," distinct(explode(map_keys(custom_tags))) as tag_key\n"," from usage_filtered\n",")\n","select * from tag_key_selection"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":""}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}}]},{"name":"f768db5b","displayName":"select_rank_key","queryLines":["with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," usage_metadata\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","-- enumerate all usage_metadata keys\n","usage_metadata_keys as (\n"," select\n"," distinct(explode(\n"," map_keys(from_json(\n"," to_json(usage_metadata),\n"," 'map'\n"," ))\n"," )) as rank_key\n"," from usage_filtered\n",")\n","select explode(array('workspace', 'run_as')) as rank_key\n","union all\n","select rank_key from usage_metadata_keys"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}]},{"name":"eb49bbaa","displayName":"select_serverless_flag","queryLines":["select explode(array(\n"," 'all',\n"," 'Serverless',\n"," 'Classic'\n",")) as group_key"]},{"name":"a5da9d48","displayName":"select_billing_origin_product","queryLines":["SELECT DISTINCT billing_origin_product \n","FROM system.billing.usage\n","WHERE billing_origin_product IS NOT NULL"]},{"name":"988516d6","displayName":"select_tag_group","queryLines":["select explode(array(\n"," 'Tag Key-Value Pairs',\n"," 'Workspace',\n"," 'Product',\n"," 'SKU',\n"," --'Serverless',\n"," --'Photon',\n"," 'Matched Status'\n",")) as group_key"]},{"name":"629a2ebe","displayName":"select_tag_agg_toggle","queryLines":["select explode(array(\n"," 'Key-Value Pairs',\n"," 'Keys'\n",")) as toggle"]},{"name":"8b6b5367","displayName":"select_tag_agg_top_tags","queryLines":["select explode(array(\n"," 'Key-Value Pairs',\n"," 'Keys',\n"," 'Values'\n",")) as toggle"]},{"name":"bb990f09","displayName":"select_include_remaining","queryLines":["select explode(array(\n"," 'Yes',\n"," 'No'\n",")) as toggle"]},{"name":"2b5e3641","displayName":"select_case_sensitivity","queryLines":["select explode(array(\n"," 'Yes',\n"," 'No'\n",")) as toggle"]},{"name":"17558292","displayName":"select_feature_flag_toggle","queryLines":["select explode(array(\n"," 'Enabled',\n"," 'Disabled'\n",")) as toggle"]},{"name":"1100555f","displayName":"select_account_prices_toggle","queryLines":["select explode(array(\n"," 'system.billing.list_prices',\n"," 'system.billing.account_prices'\n",")) as toggle"]},{"name":"eb3d55f9","displayName":"select_enable_links_toggle","queryLines":["select explode(array(\n"," 'Enabled',\n"," 'Disabled'\n",")) as toggle"]},{"name":"6b9e03f6","displayName":"usage_overview","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","clean_results AS (\n","-- query\n","select\n"," time_key, group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd_dynamic,\n"," usage_usd,\n"," usage_unit,\n"," usage_dbus,\n"," IsServerless, \n"," workspace_norm,\n"," 'Actuals' AS usage_type,\n"," CONCAT('per ', CAST(:param_time_key AS STRING)) AS time_period,\n"," start_time AS start_time_window,\n"," end_time AS end_time_window,\n"," CONCAT(CAST(start_time AS STRING), ' to ', CAST(end_time AS STRING)) AS time_window_string\n","from list_priced_usd_with_time_and_group_keys\n",")\n","\n","SELECT * FROM clean_results"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}}],"columns":[{"displayName":"Avg USD Spent","description":"","expression":"AVG(usage_usd)"},{"displayName":"period_run_rate","description":"","expression":"try_divide(SUM(usage_usd), COUNT(DISTINCT time_key))"}]},{"name":"e1dac524","displayName":"usage_forecast","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","clean_results AS (\n","select\n"," time_key,\n"," SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) AS usage_usd_dynamic,\n"," 'Actuals' AS usage_type,\n"," MIN(start_time) AS start_time_window,\n"," MAX(end_time) AS end_time_window\n","from list_priced_usd_with_time_and_group_keys\n","group by time_key\n","),\n","\n","--- AI Forecast & PoP change\n","\n","forecast AS (\n","\n"," WITH time_range AS (\n"," SELECT \n"," CASE WHEN :param_time_key = 'Month' THEN timestampadd(MONTH, :units_to_predict, now()) \n"," WHEN :param_time_key = 'Day' THEN timestampadd(DAY, :units_to_predict, now())\n"," WHEN :param_time_key = 'Week' THEN timestampadd(WEEK, :units_to_predict, now())\n"," WHEN :param_time_key = 'Quarter' THEN timestampadd(QUARTER, :units_to_predict, now())\n"," WHEN :param_time_key = 'Year' THEN timestampadd(YEAR, :units_to_predict, now())\n"," ELSE timestampadd(MONTH, :units_to_predict, now())\n"," END AS end_time,\n"," :forecast_toggle AS forecast_toggle\n"," \n"," )\n","\n"," SELECT *,\n"," MIN(time_key) OVER() AS start_time_window,\n"," MAX(time_key) OVER() AS end_time_raw,\n"," CASE \n"," WHEN UPPER(:param_time_key) = 'DAY' THEN DATE_ADD(end_time_raw, 0) -- Same day\n"," WHEN UPPER(:param_time_key) = 'WEEK' THEN DATE_ADD(end_time_raw, 6)\n"," WHEN UPPER(:param_time_key) = 'MONTH' THEN DATE_ADD(DATE_TRUNC('MONTH', ADD_MONTHS(end_time_raw, 1)), -1)\n"," WHEN UPPER(:param_time_key) = 'QUARTER' THEN DATE_ADD(DATE_TRUNC('QUARTER', ADD_MONTHS(end_time_raw, 3)), -1)\n"," WHEN UPPER(:param_time_key) = 'YEAR' THEN DATE_ADD(DATE_TRUNC('YEAR', ADD_MONTHS(end_time_raw, 12)), -1)\n"," END AS end_time_window\n"," FROM AI_FORECAST(\n"," TABLE (clean_results),\n"," horizon => (SELECT MAX(end_time) FROM time_range),\n"," time_col => 'time_key',\n"," value_col => ARRAY('usage_usd_dynamic'),\n"," prediction_interval_width => 0.9,\n"," parameters => '{\"global_floor\": 0}'\n"," )\n"," WHERE usage_usd_dynamic_forecast IS NOT NULL\n",")\n","\n","SELECT time_key, usage_usd_dynamic, NULL AS upper_forecast, NULL AS lower_forecast, usage_type, :param_time_key AS time_period,\n","start_time_window,\n","end_time_window,\n","CONCAT(CAST(start_time_window AS STRING), ' to ', CAST(end_time_window AS STRING)) AS time_window_string\n","FROM clean_results\n","UNION ALL \n","SELECT time_key, usage_usd_dynamic_forecast AS usage_usd_dynamic, usage_usd_dynamic_upper AS upper_forecast, usage_usd_dynamic_lower AS lower_forecast , 'Forecast' AS usage_type, :param_time_key AS time_period,\n","start_time_window,\n","end_time_window,\n","CONCAT(CAST(start_time_window AS STRING), ' to ', CAST(end_time_window AS STRING)) AS time_window_string\n","FROM forecast WHERE CASE WHEN :forecast_toggle = 'Enabled' THEN true ELSE false END"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"units_to_predict","keyword":"units_to_predict","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"5"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"forecast_toggle","keyword":"forecast_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}}],"columns":[{"displayName":"Avg USD Spent","description":"","expression":"AVG(usage_usd_dynamic)"},{"displayName":"forecasted_run_rate","description":"","expression":"try_divide(SUM(CASE WHEN usage_type = 'Forecast' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Forecast' THEN time_key END))\n"},{"displayName":"actuals_run_rate","description":"","expression":"try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n"},{"displayName":"forecast_percent_increase","description":"","expression":"try_divide(\n try_divide(SUM(CASE WHEN usage_type = 'Forecast' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Forecast' THEN time_key END)) \n - \n try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n ,\n try_divide(SUM(CASE WHEN usage_type = 'Actuals' THEN usage_usd_dynamic END), COUNT(DISTINCT CASE WHEN usage_type = 'Actuals' THEN time_key END))\n)"}]},{"name":"f14c46e1","displayName":"usage_overview_pop_matrix","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n"," WHERE \n"," (array_contains(:is_serverless, IsServerless) OR array_contains(:is_serverless,'all'))\n","),\n","list_priced_usd_with_time_and_group_keys as (\n"," select\n"," workspace as workspace_norm,\n"," CASE\n"," WHEN :param_group_key = 'Workspace' THEN workspace_norm\n"," WHEN :param_group_key = 'Product' THEN billing_origin_product\n"," WHEN :param_group_key = 'SKU' THEN sku_name\n"," WHEN :param_group_key = 'Photon' THEN IsPhoton\n"," WHEN :param_group_key = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," *\n"," from list_priced_usd_with_time_key u\n","),\n","\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," replace(replace(group_key, '<', '<'), '>', '>') as group_key,\n"," -- Make dynamic\n"," SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) AS usage_usd\n"," from list_priced_usd_with_time_and_group_keys\n"," group by all\n","),\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round((usage_usd - prev_usage_usd) / prev_usage_usd * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round((sum(usage_usd) - prev_usage_usd) / prev_usage_usd * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","\n","pre_format_results AS (\n","-- query\n","select\n"," group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' \n"," THEN concat('$', format_number(float(`Start to End date`), 0))\n"," WHEN :usage_toggle = 'DBUs'\n"," THEN concat('', format_number(float(`Start to End date`), 0))\n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," '' as group_key,\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT *,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," -- add data bars\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n"," FROM pre_format_results\n","order by _order asc, _all_time_usage_usd desc"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_group_key","keyword":"param_group_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"a28f5b19","displayName":"tag_analysis_top_tags","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd,\n"," workspace,\n"," IsServerless,\n"," IsPhoton,\n"," billing_origin_product,\n"," explode(custom_tags)\n","FROM list_priced_usd AS u\n","),\n","\n","pre_filter AS (\n","SELECT\n"," CASE WHEN :top_tag_aggregate_by = 'Keys' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN trim(lower(key)) ELSE key END \n"," WHEN :top_tag_aggregate_by = 'Key-Value Pairs' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN CONCAT(COALESCE(lower(trim(key)), ''), '=', COALESCE(lower(trim(value)), '')) END\n"," WHEN :top_tag_aggregate_by = 'Values' THEN \n"," CASE WHEN :normalize_case = 'Yes' THEN trim(lower(value)) ELSE value END\n"," END AS dynamic_tag_rollup,\n","workspace,\n","time_key,\n","IsServerless, \n","IsPhoton, \n","billing_origin_product, \n","SUM(usage_usd) AS usage_usd\n","FROM exploded_usage_tags_to_compare\n","GROUP BY ALL\n","),\n","\n","tag_rank AS (\n","SELECT\n","dynamic_tag_rollup,\n","SUM(usage_usd) AS usage_usd,\n","ROW_NUMBER() OVER(ORDER BY SUM(usage_usd) DESC) AS tag_rank_number\n","FROM pre_filter\n","GROUP BY dynamic_tag_rollup\n",")\n","\n","\n","SELECT p.*, tag_rank_number\n","FROM pre_filter p \n","INNER JOIN tag_rank tr ON p.dynamic_tag_rollup = tr.dynamic_tag_rollup\n","WHERE tag_rank_number <= :top_n_tags"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"top_tag_aggregate_by","keyword":"top_tag_aggregate_by","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Keys"}]}}},{"displayName":"top_n_tags","keyword":"top_n_tags","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"10"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}],"columns":[{"displayName":"tag_match_rate","description":"Matched Usage divided by total usage","expression":"coalesce(try_divide(Measure_MatchedUsage,usage_usd), 0.0)\n"}]},{"name":"d61a4eeb","displayName":"tag_analysis_summary","queryLines":["SET ansi_mode = true;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (SELECT record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '', '') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select\n"," mt._custom_tag_key_value_pairs,\n"," COALESCE(mt.custom_tag_key_value_pairs, '') AS custom_tag_key_value_pairs,\n"," -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," COALESCE(IsMatched, '') AS IsMatchedClean,\n"," array_distinct(mt.matched_tags_array) AS kvp,\n"," k.*\n"," from\n"," list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n","),\n","\n","\n","pre_ui_results AS (\n"," -- query\n"," select\n"," time_key,\n"," IsServerless,\n"," IsPhoton,\n"," workspace AS workspace_id,\n"," billing_origin_product,\n"," sku_name,\n"," IsMatchedClean,\n"," CASE\n"," WHEN custom_tag_key_value_pairs IN ('', '')\n"," OR :normalize_case = 'No' THEN custom_tag_key_value_pairs\n"," ELSE lower(custom_tag_key_value_pairs)\n"," END AS custom_tag_key_value_pairs,\n"," -- Make dynamic\n"," CASE\n"," WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END AS usage_usd,\n"," kvp\n"," from\n"," list_priced_usd_with_matching_tag_kvp\n"," where\n"," (\n"," CASE\n"," WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN custom_tag_key_value_pairs IN ('', '')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN custom_tag_key_value_pairs NOT IN ('', '')\n"," END\n"," )\n",")\n","SELECT\n"," CASE\n"," WHEN :tag_group = 'Workspace' THEN workspace_id\n"," WHEN :tag_group = 'Product' THEN billing_origin_product\n"," WHEN :tag_group = 'SKU' THEN sku_name\n"," WHEN :tag_group = 'Matched Status' THEN IsMatchedClean\n"," WHEN :tag_group = 'Tag Key-Value Pairs' THEN custom_tag_key_value_pairs\n"," WHEN :tag_group = 'Photon' THEN IsPhoton\n"," WHEN :tag_group = 'Serverless' THEN IsServerless\n"," END AS group_key,\n"," CASE\n"," WHEN IsMatchedClean = '' THEN usage_usd\n"," ELSE 0\n"," END AS Measure_MatchedUsage,\n"," *\n","FROM\n"," pre_ui_results"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"tag_group","keyword":"tag_group","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Tag Key-Value Pairs"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}}],"columns":[{"displayName":"tag_match_rate","description":"Matched Usage divided by total usage","expression":"coalesce(try_divide(Measure_MatchedUsage,usage_usd), 0.0)\n"}]},{"name":"437db86b","displayName":"tag_analysis_pop_matrix","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (SELECT record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '<NO TAG MATCH>', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '<TAG MATCH>', '<NO TAG MATCH>') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select mt._custom_tag_key_value_pairs,\n"," COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') AS custom_tag_key_value_pairs, -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," COALESCE(IsMatched, '<NOT TAGGED>') AS IsMatchedClean,\n"," mt.matched_tags_array AS kvp,\n"," k.*\n"," from list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n"," where\n"," (CASE WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," END)\n"," ),\n","\n","total_match_percent AS (\n","select\n"," sum(if(custom_tag_key_value_pairs NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>'), -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END, 0)) as match_usage_usd,\n"," sum( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) as total_usage_usd,\n"," round(try_divide(match_usage_usd , total_usage_usd), 3) as tag_match_percentage\n","from list_priced_usd_with_matching_tag_kvp\n","),\n","\n","\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," CASE\n"," WHEN :tag_group = 'Workspace' THEN workspace\n"," WHEN :tag_group = 'Product' THEN billing_origin_product\n"," WHEN :tag_group = 'SKU' THEN sku_name\n"," WHEN :tag_group = 'Matched Status' THEN IsMatchedClean\n"," WHEN :tag_group = 'Tag Key-Value Pairs' THEN custom_tag_key_value_pairs\n"," WHEN :tag_group = 'Photon' THEN IsPhoton\n"," WHEN :tag_group = 'Serverless' THEN IsServerless\n"," END AS group_key, -- Make results aggregation optionally case sensitive\n"," sum( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END) as usage_usd\n"," from list_priced_usd_with_matching_tag_kvp\n"," group by all\n","),\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round(try_divide((usage_usd - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round(try_divide((sum(usage_usd) - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","-- query\n","\n","results_pre_format AS (\n","select\n"," CASE WHEN group_key IN ('<NOT TAGGED>', '<NO TAG MATCH>', '<TAG MATCH>', 'TOTAL') OR :normalize_case = 'No' THEN group_key ELSE lower(group_key) END AS group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' \n"," THEN concat('$', format_number(float(`Start to End date`), 0))\n"," WHEN :usage_toggle = 'DBUs'\n"," THEN concat('', format_number(float(`Start to End date`), 0))\n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n","\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," CONCAT(' ', round((SELECT MAX(tag_match_percentage) FROM total_match_percent)*100, 2)::string,'% of usage matching tag search') as group_key, -- This is the formatted total matching percent across tags\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT *,\n","CONCAT(\n"," '', \n"," group_key, \n"," ''\n"," ) AS group_key_html,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n","FROM results_pre_format\n","order by _order asc, _all_time_usage_usd desc;"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"tag_group","keyword":"tag_group","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Tag Key-Value Pairs"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"450b2674","displayName":"tag_analysis_match_details","queryLines":["SET ansi_mode = True;\n","\n","WITH workspace AS (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select \n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," workspace_name,\n"," workspace_url,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where\n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," AND \n"," -- Serverless Filter\n"," (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select \n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," u.*,\n"," COALESCE(\n"," (SELECT /*+ BROADCAST(ce) */ MAX(clean_room_name) FROM system.access.clean_room_events ce WHERE ce.central_clean_room_id = usage_metadata.central_clean_room_id),\n"," (SELECT /*+ BROADCAST(se) */ MAX(endpoint_name) FROM system.serving.served_entities se WHERE se.workspace_id = workspace_id AND se.endpoint_id = usage_metadata.endpoint_id)\n"," ) AS asset_name\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," usage_date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","\n","tag_entry_parsing AS (\n"," SELECT \n"," tag_entry,\n"," contains(tag_entry, '=') AS is_filter,\n"," IF(contains(tag_entry, '='), split(tag_entry, '=')[0], tag_entry) AS tag_key,\n"," ROW_NUMBER() OVER (ORDER BY tag_entry) AS tag_id\n"," FROM (\n"," SELECT explode(split(:param_tag_entries, ';')) AS tag_entry\n"," FROM VALUES(1) AS dummy(x)\n"," )\n","),\n","\n","exploded_usage_tags_to_compare AS (\n","SELECT\n"," record_id,\n"," explode(custom_tags),\n"," custom_tags\n","FROM usage_filtered AS u\n","),\n","\n","matched_records AS (\n"," SELECT\n"," record_id,\n"," -- array of maps that match\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN concat(spine.key, '=', spine.value) END) AS matched_tags_array,\n"," array_agg(concat(spine.key, '=', spine.value)) AS usage_tags_array,\n"," -- Add keys only agg view\n"," array_agg(CASE WHEN tag_id IS NOT NULL THEN spine.key END) AS matched_keys_array,\n"," array_agg(spine.key) AS usage_keys_array, \n"," -- \n"," size(matched_tags_array) AS matched_tag_count,\n"," (SELECT COUNT (0) FROM tag_entry_parsing WHERE length(tag_entry) > 0) AS search_tag_count,\n","\n"," if(search_tag_count = 0 OR search_tag_count = size(matched_tags_array),\n"," -- Add key aggregation option\n"," CASE WHEN :group_agg_mode = 'Key-Value Pairs' THEN array_join(array_distinct(matched_tags_array), ';') WHEN :group_agg_mode = 'Keys' THEN array_join(array_distinct(matched_keys_array), ';') END\n"," , ''\n"," ) as _custom_tag_key_value_pairs,\n","\n"," if(_custom_tag_key_value_pairs = \"\", '<NO TAG MATCH>', _custom_tag_key_value_pairs) as custom_tag_key_value_pairs,\n"," -- Is match yes/no\n"," if (search_tag_count = 0 OR search_tag_count = size(matched_tags_array), '<TAG MATCH>', '<NO TAG MATCH>') AS IsMatched\n","FROM exploded_usage_tags_to_compare AS spine\n","LEFT JOIN tag_entry_parsing AS tt ON\n"," (CASE WHEN :normalize_case = 'Yes'\n"," THEN \n"," (-- Join on Key only if is_filter = false\n"," (trim(lower(tt.tag_key)) = trim(lower(spine.key)) AND tt.is_filter = false)\n"," OR \n"," (trim(lower(tt.tag_entry)) = concat(trim(lower(spine.key)), '=', trim(lower(spine.value))) AND tt.is_filter = true)\n"," )\n"," ELSE \n"," (-- Join on Key only if is_filter = true\n"," (tt.tag_key = spine.key AND tt.is_filter = false)\n"," OR \n"," (tt.tag_entry = concat(spine.key, '=', spine.value) AND tt.is_filter = true)\n"," )\n"," END )\n","GROUP BY record_id\n","),\n","\n","-- match tag entries\n","list_priced_usd_with_matching_tag_kvp as (\n"," select\n"," mt._custom_tag_key_value_pairs,\n"," COALESCE(IsMatched, '<NOT TAGGED>') AS IsMatched,\n"," COALESCE(mt.custom_tag_key_value_pairs, '<NOT TAGGED>') AS custom_tag_key_value_pairs, -- There are matched tag records, then records with tags that dont match the ask, then totally untagged resources\n"," mt.matched_tags_array AS kvp,\n"," k.*,\n"," usage_metadata.job_id AS job_id,\n"," usage_metadata.cluster_id AS cluster_id,\n"," usage_metadata.dlt_pipeline_id AS dlt_pipeline_id,\n"," usage_metadata.warehouse_id AS warehouse_id\n"," from list_priced_usd_with_time_key k\n"," left join matched_records as mt ON k.record_id = mt.record_id\n"," )\n",",\n","\n","-- Dim tables to get names, deleted, and owner\n","clusters AS (\n"," SELECT /*+ REPARTITION(2, cluster_id) */\n"," workspace_id,\n"," cluster_id,\n"," cluster_name AS object_name,\n"," owned_by AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.compute.clusters\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, cluster_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY cluster_id\n","),\n","\n","jobs AS (\n"," SELECT /*+ REPARTITION(2, job_id) */\n"," workspace_id,\n"," job_id,\n"," name AS object_name,\n"," '' AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.lakeflow.jobs\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY job_id\n","),\n","\n","pipelines AS (\n"," SELECT /*+ REPARTITION(2, pipeline_id) */\n"," workspace_id,\n"," pipeline_id,\n"," name AS object_name,\n"," COALESCE(run_as, created_by) AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.lakeflow.pipelines\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, pipeline_id ORDER BY change_time DESC) = 1\n"," -- CLUSTER BY pipeline_id\n","),\n","\n","warehouses AS (\n"," SELECT /*+ REPARTITION(2, warehouse_id) */\n"," workspace_id,\n"," warehouse_id,\n"," warehouse_name AS object_name,\n"," '' AS object_owner,\n"," CASE WHEN delete_time IS NOT NULL THEN 1 ELSE 0 END AS is_deleted\n"," FROM system.compute.warehouses\n"," QUALIFY ROW_NUMBER() OVER (PARTITION BY workspace_id, warehouse_id ORDER BY change_time DESC) = 1\n"," --CLUSTER BY warehouse_id\n","),\n","\n","\n","pre_results AS (\n","\n","select /*+ BROADCAST(j), BROADCAST(c), BROADCAST(p), BROADCAST(w) */\n","coalesce(identity_metadata.run_as, identity_metadata.owned_by, identity_metadata.created_by, j.object_owner, c.object_owner, p.object_owner) AS asset_owner,\n","CASE WHEN coalesce(j.is_deleted,c.is_deleted, p.is_deleted, w.is_deleted) = 1 THEN 'deleted'\n"," WHEN coalesce(j.is_deleted,c.is_deleted, p.is_deleted, w.is_deleted) = 0 THEN 'active'\n"," ELSE 'unknown'\n"," END AS is_deleted,\n","coalesce(tk.asset_name, j.object_name,c.object_name, p.object_name, w.object_name, 'unknown') AS clean_asset_name,\n","-----==== Route to the object itself ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN CONCAT(COALESCE(workspace_url, ''), '/compute/clusters/', usage_metadata.cluster_id) -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'JOBS' THEN CONCAT(COALESCE(workspace_url, ''), '/jobs/', usage_metadata.job_id) -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN CONCAT(COALESCE(workspace_url, ''), '/sql/warehouses/', usage_metadata.warehouse_id, '?o=', tk.workspace_id) ELSE CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id, '?o=', tk.workspace_id) END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'APPS' THEN CONCAT(COALESCE(workspace_url, ''), '/apps/', usage_metadata.app_name)\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN NULL -- background service\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN CASE WHEN asset_name IS NULL THEN NULL ELSE CONCAT(COALESCE(workspace_url, ''), '/explore/cleanrooms/', COALESCE(asset_name, usage_metadata.central_clean_room_id), '?o=', COALESCE(tk.workspace_id, '')) END\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN CONCAT('/pipelines/', usage_metadata.dlt_pipeline_id) \n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN NULL -- NOT SUPPORTED \n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN CONCAT(COALESCE(workspace_url, ''), '/ml/endpoints/', usage_metadata.endpoint_name)\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN CONCAT(COALESCE(workspace_url, ''), CONCAT('/compute/vector-search/', usage_metadata.endpoint_name), '?o=', COALESCE(tk.workspace_id, ''))\n"," WHEN billing_origin_product = 'DATABASE' THEN NULL -- TBD\n"," -- WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n","\n"," END AS asset_url_router,\n","\n","-----==== Asset Identifier (id or name if no id) ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN usage_metadata.cluster_id -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CASE WHEN usage_metadata.notebook_id IS NOT NULL THEN usage_metadata.notebook_id\n"," WHEN product_features.is_serverless = True THEN asset_owner END -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'NETWORKING' THEN CONCAT(usage_metadata.source_region, ' -> ',usage_metadata.destination_region)\n"," WHEN billing_origin_product = 'FINE_GRAINED_ACCESS_CONTROL' THEN CASE WHEN product_features.is_serverless = True THEN asset_owner END\n"," WHEN billing_origin_product = 'AGENT_EVALUATION' THEN asset_owner -- user doing agent eval\n"," WHEN billing_origin_product = 'JOBS' THEN usage_metadata.job_id -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN usage_metadata.warehouse_id ELSE usage_metadata.dlt_pipeline_id END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CASE WHEN usage_metadata.dlt_pipeline_id IS NOT NULL THEN usage_metadata.dlt_pipeline_id\n"," WHEN usage_metadata.cluster_id IS NOT NULL THEN usage_metadata.cluster_id\n"," END -- Can be pipeline id or cluster id for classic DLT\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN usage_metadata.dlt_pipeline_id\n"," WHEN billing_origin_product = 'APPS' THEN usage_metadata.app_name\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN usage_metadata.central_clean_room_id\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN usage_metadata.notebook_id -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN 'Background Service' -- background service\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN usage_metadata.dlt_pipeline_id\n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN usage_metadata.ai_runtime_pool_id\n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN usage_metadata.endpoint_name\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN usage_metadata.endpoint_id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN custom_tags.EndpointId\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN usage_metadata.cluster_id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN COALESCE(usage_metadata.endpoint_name, usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'FOUNDATION_MODEL_TRAINING' THEN usage_metadata.run_name -- TO DO - Needs better link identifier and experiemnt Id and user id\n"," WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN usage_metadata.database_instance_id -- TBD\n"," END AS asset_id,\n","\n","-----==== Type of Asset (id/name description) ====-----\n","CASE WHEN billing_origin_product = 'ALL_PURPOSE' THEN 'All Purpose Cluster Id' -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CASE WHEN usage_metadata.notebook_id IS NOT NULL THEN 'Serverless Notebook Id'\n"," WHEN product_features.is_serverless = True THEN 'Serverless Interactive Usage' END\n"," WHEN billing_origin_product = 'NETWORKING' THEN 'Network Route'\n"," WHEN billing_origin_product = 'FINE_GRAINED_ACCESS_CONTROL' THEN CASE WHEN product_features.is_serverless = True THEN 'Fine Grained Access Filtering' END\n"," WHEN billing_origin_product = 'AGENT_EVALUATION' THEN 'User Agent Evaluation' -- user doing agent eval\n"," WHEN billing_origin_product = 'JOBS' THEN 'Workflow - Job Id' -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN 'SQL Warehouse' ELSE 'SQL - DLT ST/MVs' END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CASE WHEN usage_metadata.dlt_pipeline_id IS NOT NULL THEN 'DLT Pipeline Id'\n"," WHEN usage_metadata.cluster_id IS NOT NULL THEN 'DLT Cluster Id'\n"," END -- Can be pipeline id or cluster id for classic DLT\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN 'Online Table DLT Pipeline Id' -- 'Not yet recorded'\n"," WHEN billing_origin_product = 'APPS' THEN 'Lakehouse App Name'\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN 'Cleanroom Id / Name'\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN 'Lakeflow Pipeline Id'\n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN 'AI Runtime Pool Id'\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN 'Serverless Notebook Id'-- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN 'Predictive Optimization Usage' -- background service\n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN 'Model Serving Endpoint Name'\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN 'Model Serving Endpoint Id'\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN 'Model Serving Endpoint Id'\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN 'Model Serving Cluster Id'\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN 'Vector Search Endpoint Name' -- TO DO - Needs better link identifier and owner info - Need Vector search name\n"," WHEN billing_origin_product = 'FOUNDATION_MODEL_TRAINING' THEN 'Training Experiment Run'-- TO DO - Needs better link identifier and experiemnt Id and user id\n"," WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN 'Table Id Monitor' -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN 'Database Instance Id' -- TO DO - Needs better link identifier via database name\n"," END AS asset_type,\n"," CASE WHEN asset_id IS NOT NULL THEN 'Identified' ELSE 'Unknown Asset Id' END AS IsClassifiedIntoAsset,\n","case\n"," when :param_time_key = 'Day' then :time_range.max\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max)\n","end as current_period,\n","case\n"," when :param_time_key = 'Day' then :time_range.max - interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max - interval 1 month)\n","end as last_period,\n","tk.*\n","FROM (SELECT * \n"," FROM list_priced_usd_with_matching_tag_kvp \n"," WHERE \n"," (CASE WHEN :param_show_tag_mismatch = 'All Usage' THEN True\n"," WHEN :param_show_tag_mismatch = 'Not Matched Only' THEN IsMatched IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," WHEN :param_show_tag_mismatch = 'Matched Only' THEN IsMatched NOT IN ('<NO TAG MATCH>', '<NOT TAGGED>')\n"," END)) AS tk\n","LEFT JOIN jobs j ON j.job_id = tk.job_id\n","LEFT JOIN clusters c ON c.cluster_id = tk.cluster_id\n","LEFT JOIN pipelines p ON p.pipeline_id = tk.dlt_pipeline_id\n","LEFT JOIN warehouses w ON w.warehouse_id = tk.warehouse_id\n","), \n","\n","agg_final AS (\n","-- Aggregate\n","SELECT\n","workspace AS workspace_id,\n","billing_origin_product,\n","asset_type,\n","asset_id,\n","CASE WHEN :enable_links_toggle = 'Enabled' THEN asset_url_router ELSE NULL END AS asset_url_router,\n","IsClassifiedIntoAsset,\n","IsServerless,\n","usage_type,\n","COALESCE(MAX(is_deleted), 'unknown') AS is_object_deleted,\n","FIRST(current_period) AS current_period,\n","FIRST(last_period) AS last_period,\n","SUM( -- Make dynamic\n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) FILTER(WHERE usage_date >= current_period) as current_period_usage_usd,\n","SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) FILTER(WHERE usage_date BETWEEN last_period AND current_period) as last_period_usage_usd,\n","MAX_BY(COALESCE(asset_owner), usage_end_time) AS usage_owner,\n","-- Most recent asset name (they can change)\n","MAX_BY(clean_asset_name, usage_end_time) AS MostRecentAssetName,\n","-- Most recent is matched\n","MAX_BY(IsMatched, usage_end_time) AS MostRecentIsMatched,\n","-- Most recent tag pairs\n","MAX_BY(custom_tag_key_value_pairs, usage_end_time) AS MostRecentTagKeyValuePairs,\n","-- Most recent usage date\n","MAX_BY(usage_date, usage_end_time) AS MostRecentUsageDate,\n","-- Days since most recent usage\n","date_diff(current_date()::date, MostRecentUsageDate) AS DaysSinceMostRecentUsage,\n","-- First Usage Date In Window\n","MIN_BY(usage_date, usage_end_time) AS EarliestUsageDate,\n","-- Total Usage\n","SUM(CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) AS TotalDollarsUsage,\n","SUM(usage_quantity) AS TotalDBUUsageQuantity,\n","-- Most recent custom_tags value\n","MAX_BY(custom_tags, usage_end_time) AS MostRecentTagsOnAsset,\n","-- Most recent usage metadata\n","MAX_BY(usage_metadata, usage_end_time) AS MostRecentUsageMetadata,\n","MAX_BY(product_features, usage_end_time) AS MostRecentProductFeatures\n","FROM pre_results\n","GROUP BY \n","workspace,\n","billing_origin_product,\n","asset_type,\n","asset_id,\n","CASE WHEN :enable_links_toggle = 'Enabled' THEN asset_url_router ELSE NULL END,\n","IsClassifiedIntoAsset,\n","IsServerless,\n","usage_type\n","),\n","\n","asset_ranks AS (\n","\n","SELECT \n","CONCAT(\n"," '', \n"," MostRecentIsMatched, \n"," ''\n"," ) AS MatchedKey_html,\n"," CASE WHEN MostRecentIsMatched = '<NOT TAGGED>' THEN 'NOT TAGGED'\n"," WHEN MostRecentIsMatched = '<NO TAG MATCH>' THEN 'NO TAG MATCH'\n"," WHEN MostRecentIsMatched = '<TAG MATCH>' THEN 'MATCHED'\n"," END AS clean_ui_is_matched,\n","af.*,\n"," -- PoP usage change\n"," CASE WHEN last_period_usage_usd IS NULL THEN 0 \n"," ELSE ROUND((try_divide((current_period_usage_usd - last_period_usage_usd) , last_period_usage_usd))*100, 2) END AS percent_pop_change,\n"," -- add data bars on USAGE\n"," MAX(TotalDollarsUsage) OVER() AS max_usage_dollars,\n"," MIN(TotalDollarsUsage) OVER() AS min_usage_dollars,\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(TotalDollarsUsage, 0), \n"," '
'\n"," ), CAST(TotalDollarsUsage AS STRING)) AS usage_dollars_html,\n","\n"," MAX(DaysSinceMostRecentUsage) OVER() AS max_usage_days,\n"," MIN(DaysSinceMostRecentUsage) OVER() AS min_usage_days,\n"," CONCAT(\n"," '',\n"," ROUND(DaysSinceMostRecentUsage, 1), \n"," ' days'\n"," ) AS heat_color_html,\n","ROW_NUMBER() OVER(ORDER BY TotalDollarsUsage DESC) AS top_n_asset\n","FROM agg_final af\n","\n",")\n","\n","SELECT \n","*\n","FROM asset_ranks\n","WHERE top_n_asset <= :top_n_asset\n","ORDER BY TotalDollarsUsage DESC"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"param_tag_entries","keyword":"param_tag_entries","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Budget;Env"}]}}},{"displayName":"group_agg_mode","keyword":"group_agg_mode","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Key-Value Pairs"}]}}},{"displayName":"normalize_case","keyword":"normalize_case","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"All Usage"}]}}},{"displayName":"enable_links_toggle","keyword":"enable_links_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"top_n_asset","keyword":"top_n_asset","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"50"}]}}}]},{"name":"03f6453c","displayName":"top_spending_assets_summary","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," -- Serverless\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," identifier\n"," (\n"," case\n"," when :param_time_key = 'Year' then 'usage_year'\n"," when :param_time_key = 'Quarter' then 'usage_quarter'\n"," when :param_time_key = 'Month' then 'usage_month'\n"," when :param_time_key = 'Week' then 'usage_week'\n"," when :param_time_key = 'Day' then 'usage_date'\n"," else 'usage_date'\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","-- eval rank_key param\n","list_priced_usd_with_rank_key as (\n"," select\n"," struct(workspace) as rank_metadata,\n"," identifier\n"," (\n"," case\n"," when :param_rank_key = 'workspace' then 'rank_metadata'\n"," when :param_rank_key = 'run_as' then 'identity_metadata'\n"," else 'usage_metadata'\n"," end\n"," )[:param_rank_key] as rank_key,\n"," *\n"," from list_priced_usd_with_time_key\n","),\n","-- calc top ranked usage\n","top_ranked_usage as (\n"," select\n"," rank_key,\n"," true as is_top_ranked,\n"," sum( \n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) as usage_usd\n"," from list_priced_usd_with_rank_key\n"," where rank_key is not null\n"," group by rank_key\n"," order by usage_usd desc\n"," limit :param_top_n\n","),\n","list_priced_usd_with_rank_key_normalized as (\n"," select\n"," if(is_top_ranked or u.rank_key is null, u.rank_key, '') as rank_key,\n"," u.time_key,\n"," u.workspace,\n"," \n"," CASE WHEN :usage_toggle = 'Dollars' THEN u.usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN u.usage_dbus\n"," ELSE u.usage_usd\n"," END AS usage_usd\n"," from list_priced_usd_with_rank_key as u\n"," left join top_ranked_usage\n"," on u.rank_key = top_ranked_usage.rank_key\n"," where \n"," CASE WHEN :include_remaining_assets = 'Yes'\n"," THEN u.rank_key is not null\n"," ELSE top_ranked_usage.rank_key IS NOT NULL\n"," END\n",")\n","\n","-- query\n","select\n"," COALESCE(rank_key, '') AS rank_key,\n"," time_key,\n"," workspace,\n"," sum(usage_usd) as usage_usd\n","from list_priced_usd_with_rank_key_normalized\n","group by all"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"param_rank_key","keyword":"param_rank_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"job_id"}]}}},{"displayName":"param_top_n","keyword":"param_top_n","dataType":"INTEGER","defaultSelection":{"values":{"dataType":"INTEGER","values":[{"value":"10"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"include_remaining_assets","keyword":"include_remaining_assets","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]},{"name":"21de1797","displayName":"top_spending_assets_pop_matrix","queryLines":["SET ansi_mode = True;\n","\n","with workspace as (\n"," SELECT\n"," account_id,\n"," workspace_id, \n"," workspace_name,\n"," workspace_url,\n"," status,\n"," concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')') AS workspace_full_name\n"," FROM system.access.workspaces_latest\n"," WHERE\n"," (array_contains(:param_workspace, concat(COALESCE(workspace_name, ''), ' (id: ', workspace_id, ')')) OR array_contains(:param_workspace,'all'))\n","),\n","\n","-- apply date filter\n","usage_with_ws_filtered_by_date as (\n"," select\n"," case\n"," when workspace_name is null then concat('id: ', u.workspace_id)\n"," else workspace_full_name\n"," end as workspace,\n"," workspace_url,\n"," u.*\n"," from system.billing.usage as u\n"," inner join workspace -- Must assume this works to filter\n"," on u.workspace_id = workspace.workspace_id\n"," where u.usage_date between :time_range.min and :time_range.max\n","),\n","\n","-- apply workspace filter\n","usage_filtered as (\n"," select\n"," *,\n"," CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END AS IsServerless,\n"," CASE WHEN product_features.is_photon = True THEN 'Photon' ELSE 'Spark' END AS IsPhoton\n"," from usage_with_ws_filtered_by_date\n"," where \n"," -- Product SKU filter\n"," (array_contains(:product_category, billing_origin_product) OR array_contains(:product_category,'all'))\n"," -- Serverless\n"," AND (array_contains(:is_serverless, CASE WHEN product_features.is_serverless = True THEN 'Serverless' ELSE 'Classic' END) OR array_contains(:is_serverless,'all'))\n","),\n","\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","list_priced_usd as (\n"," select /*+ BROADCAST(p) */\n"," -- Dynamic Prices Logic\n"," COALESCE(\n"," -- When there is a * global discounts, then use that for all\n"," (1-try_cast(regexp_extract(:discounts_by_product, '\\\\s*\\\\*\\\\s*=\\\\s*([0-9]*\\\\.?[0-9]+)', 1) AS decimal(10, 3)))* p.pricing.default * u.usage_quantity,\n"," -- When no account prices enabled, then use overrides first then default pricing\n"," (1-COALESCE(discounts.discount, 0))* p.pricing.default * u.usage_quantity,\n"," -- When all else fails, use default\n"," p.pricing.default * u.usage_quantity) as usage_usd,\n"," usage_quantity AS usage_dbus,\n"," date_trunc('YEAR', usage_date) as usage_year,\n"," date_trunc('QUARTER', usage_date) as usage_quarter,\n"," date_trunc('MONTH', usage_date) as usage_month,\n"," date_trunc('WEEK', usage_date) as usage_week,\n"," MIN(usage_date) OVER () AS start_time,\n"," MAX(usage_date) OVER () AS end_time,\n"," u.*\n"," from usage_filtered as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON (discounts.product = u.sku_name OR discounts.product = u.billing_origin_product)\n"," left join prices as p\n"," ON u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","-- Some links require the name, this is expensive so use sparingly\n","asset_names AS (\n"," SELECT \n"," usage_metadata.central_clean_room_id AS asset_id,\n"," MAX_BY(clean_room_name, ce.event_time) AS asset_name\n"," FROM list_priced_usd s\n"," LEFT JOIN system.access.clean_room_events ce ON ce.central_clean_room_id = s.usage_metadata.central_clean_room_id\n"," WHERE billing_origin_product = 'CLEAN_ROOM'\n"," GROUP BY usage_metadata.central_clean_room_id\n","),\n","\n","-- eval time_key param\n","list_priced_usd_with_time_key as (\n"," select\n"," (case\n"," when :param_time_key = 'Year' then usage_year\n"," when :param_time_key = 'Quarter' then usage_quarter\n"," when :param_time_key = 'Month' then usage_month\n"," when :param_time_key = 'Week' then usage_week\n"," when :param_time_key = 'Day' then usage_date\n"," else usage_date\n"," end\n"," )::date as time_key,\n"," *\n"," from list_priced_usd\n","),\n","-- eval rank_key param\n","list_priced_usd_with_rank_key as (\n"," select\n"," struct(workspace) as rank_metadata,\n"," identifier\n"," (\n"," case\n"," when :param_rank_key = 'workspace' then 'rank_metadata'\n"," when :param_rank_key = 'run_as' then 'identity_metadata'\n"," else 'usage_metadata'\n"," end\n"," )[:param_rank_key] as rank_key,\n"," *\n"," from list_priced_usd_with_time_key\n","),\n","\n","-- calc top ranked usage\n","top_ranked_usage as (\n"," select\n"," rank_key,\n"," true as is_top_ranked,\n"," sum( \n"," CASE WHEN :usage_toggle = 'Dollars' THEN usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN usage_dbus\n"," ELSE usage_usd\n"," END ) as usage_usd\n"," from list_priced_usd_with_rank_key\n"," where rank_key is not null\n"," group by rank_key\n"," order by usage_usd desc\n"," limit :param_top_n\n","),\n","\n","list_priced_usd_with_rank_key_normalized as (\n"," select /*+ BROADCAST(aa), BROADCAST(top_ranked_usage) */\n"," if(is_top_ranked or u.rank_key is null, u.rank_key, 'REMAINING OBJECTS') as rank_key,\n"," u.time_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN u.usage_usd\n"," WHEN :usage_toggle = 'DBUs' THEN u.usage_dbus\n"," ELSE u.usage_usd\n"," END AS usage_usd,\n","CASE WHEN u.rank_key != 'REMAINING OBJECTS' \n"," THEN coalesce(identity_metadata.run_as, identity_metadata.owned_by, identity_metadata.created_by)\n","END AS usage_owner,\n","\n","-----==== Route to the asset itself ====-----\n","CASE WHEN u.rank_key != 'REMAINING OBJECTS'\n"," THEN CASE \n"," WHEN :param_rank_key = 'workspace' THEN workspace_url\n"," WHEN :param_rank_key = 'run_as' THEN NULL\n"," WHEN billing_origin_product = 'ALL_PURPOSE' THEN CONCAT(COALESCE(workspace_url, ''), '/compute/clusters/', usage_metadata.cluster_id) -- AP clusters\n"," WHEN billing_origin_product = 'INTERACTIVE' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- Serverless All purpose usage\n"," WHEN billing_origin_product = 'JOBS' THEN CONCAT(COALESCE(workspace_url, ''), '/jobs/', usage_metadata.job_id) -- works for regular and serverless \n"," WHEN billing_origin_product = 'SQL' THEN CASE WHEN usage_metadata.warehouse_id IS NOT NULL THEN CONCAT(COALESCE(workspace_url, ''), '/sql/warehouses/', usage_metadata.warehouse_id, '?o=', workspace_id) ELSE CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id, '?o=', workspace_id) END -- Can be SQL Warehouse or DLT Serverless from ST/MVs\n"," WHEN billing_origin_product = 'DLT' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'ONLINE_TABLES' THEN CONCAT(COALESCE(workspace_url, ''), '/pipelines/', usage_metadata.dlt_pipeline_id)\n"," WHEN billing_origin_product = 'APPS' THEN CONCAT(COALESCE(workspace_url, ''), '/apps/', usage_metadata.app_name)\n"," WHEN billing_origin_product = 'NOTEBOOKS' THEN CONCAT(COALESCE(workspace_url, ''), '/editor/notebooks/', usage_metadata.notebook_id) -- There is a separate SKU for notebooks for some reason\n"," WHEN billing_origin_product = 'PREDICTIVE_OPTIMIZATION' THEN NULL -- background service\n"," WHEN billing_origin_product = 'CLEAN_ROOM' THEN CASE WHEN aa.asset_name IS NULL THEN NULL ELSE CONCAT(COALESCE(workspace_url, ''), '/explore/cleanrooms/', COALESCE(aa.asset_name, usage_metadata.central_clean_room_id), '?o=', COALESCE(workspace_id, '')) END\n"," WHEN billing_origin_product = 'LAKEFLOW_CONNECT' THEN CONCAT('/pipelines/', usage_metadata.dlt_pipeline_id) \n"," WHEN billing_origin_product = 'AI_RUNTIME' THEN NULL -- NOT SUPPORTED \n"," WHEN billing_origin_product = 'MODEL_SERVING' THEN (CASE WHEN usage_metadata.endpoint_name IS NOT NULL -- Model Serving control panel is by name\n"," THEN CONCAT(COALESCE(workspace_url, ''), '/ml/endpoints/', usage_metadata.endpoint_name)\n"," WHEN usage_metadata.endpoint_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN custom_tags.EndpointId IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," WHEN usage_metadata.cluster_id IS NOT NULL\n"," THEN NULL -- TO DO - find way to link with id\n"," END)\n"," WHEN billing_origin_product = 'VECTOR_SEARCH' THEN CONCAT(COALESCE(workspace_url, ''), CONCAT('/compute/vector-search/', usage_metadata.endpoint_name), '?o=', COALESCE(workspace_id, ''))\n"," -- WHEN billing_origin_product = 'LAKEHOUSE_MONITORING' THEN custom_tags.LakehouseMonitoringTableId -- TO DO - Needs better link identifier and more than just table Id to link to monitor\n"," WHEN billing_origin_product = 'DATABASE' THEN NULL -- TO DO\n"," END\n","END AS asset_url_router\n"," from list_priced_usd_with_rank_key as u\n"," left join top_ranked_usage\n"," on u.rank_key = top_ranked_usage.rank_key\n"," left join asset_names aa ON u.usage_metadata.central_clean_room_id = aa.asset_id\n"," where\n"," CASE WHEN :include_remaining_assets = 'Yes'\n"," THEN u.rank_key is not null\n"," ELSE top_ranked_usage.rank_key IS NOT NULL\n"," END\n","),\n","\n","group_key_routes AS (\n"," SELECT rank_key,\n"," MAX_BY(asset_url_router, time_key) AS latest_asset_route,\n"," MAX_BY(usage_owner, time_key) AS latest_asset_owner\n"," FROM list_priced_usd_with_rank_key_normalized\n"," WHERE rank_key != 'REMAINING OBJECTS'\n"," GROUP BY rank_key\n","),\n","-- calc usage by period\n","grouped_usage_by_period as (\n"," select\n"," time_key as period_key,\n"," rank_key as group_key,\n"," sum(usage_usd) as usage_usd\n"," from list_priced_usd_with_rank_key_normalized\n"," group by time_key, rank_key\n","),\n","\n","-- calc periodic change\n","grouped_usage_change as (\n"," select\n"," period_key,\n"," group_key,\n"," usage_usd,\n"," lag(usage_usd, 1) over (partition by group_key order by period_key) as prev_usage_usd,\n"," round(try_divide((usage_usd - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","total_usage_change as (\n"," select\n"," period_key,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," lag(sum(usage_usd), 1) over (order by period_key) as prev_usage_usd,\n"," round(try_divide((sum(usage_usd) - prev_usage_usd) , prev_usage_usd) * 100, 2) as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by period_key\n","),\n","-- periods\n","period_info as (\n"," select\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date)\n"," end as current_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date- interval 1 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 7 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 1 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 1 year)\n"," end as last_period,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 2 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 14 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 2 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 6 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 2 year)\n"," end as 2_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 3 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 21 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 3 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 9 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 3 year)\n"," end as 3_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 4 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 28 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 4 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 12 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 4 year)\n"," end as 4_periods_ago,\n"," case\n"," when :param_time_key = 'Day' then :time_range.max::date - interval 5 day\n"," when :param_time_key = 'Week' then date_trunc('WEEK', :time_range.max::date - interval 35 day)\n"," when :param_time_key = 'Month' then date_trunc('MONTH', :time_range.max::date - interval 5 month)\n"," when :param_time_key = 'Quarter' then date_trunc('QUARTER', :time_range.max::date - interval 15 month)\n"," when :param_time_key = 'Year' then date_trunc('YEAR', :time_range.max::date - interval 5 year)\n"," end as 5_periods_ago\n","),\n","-- pivot change\n","usage_change_pivot as (\n"," select\n"," case\n"," when period_key = current_period then 'Current period'\n"," when period_key = last_period then 'Last period'\n"," when period_key = 2_periods_ago then '2 periods ago'\n"," when period_key = 3_periods_ago then '3 periods ago'\n"," when period_key = 4_periods_ago then '4 periods ago'\n"," when period_key = 5_periods_ago then '5 periods ago'\n"," end as x_period_back,\n"," group_key,\n"," usage_usd,\n"," usage_change_percentage\n"," from (\n"," select * from grouped_usage_change, period_info\n"," union all\n"," select * from total_usage_change, period_info\n"," )\n","),\n","\n","-- pivot all time\n","all_time_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n"," group by group_key\n","),\n","-- pivot total all time\n","all_time_total_usage_pivot as (\n"," select\n"," 'Start to End date' as x_period_back,\n"," 'TOTAL' as group_key,\n"," sum(usage_usd) as usage_usd,\n"," null as usage_change_percentage\n"," from grouped_usage_by_period\n","),\n","union_usage_pivot as (\n"," select\n"," x_period_back,\n"," group_key,\n"," case\n"," when x_period_back = 'Start to End date' then string(usage_usd)\n"," else concat('', usage_usd_str, ' ', usage_change_str, '')\n"," end as usage_info\n"," from (\n"," select\n"," case\n"," when usage_usd >= 1e9 then concat(format_number(usage_usd / 1e9, 0), 'B')\n"," when usage_usd >= 1e6 then concat(format_number(usage_usd / 1e6, 0), 'M')\n"," when usage_usd >= 1e3 then concat(format_number(usage_usd / 1e3, 0), 'K')\n"," else format_number(usage_usd, 0)\n"," end as usage_usd_str,\n"," case\n"," when usage_change_percentage > 10 then '#00A972'\n"," when usage_change_percentage < -10 then '#FF3621'\n"," else '#919191'\n"," end as _change_color,\n"," concat('(', if(usage_change_percentage > 0, '+', ''), format_number(usage_change_percentage, 0), '%)') as _usage_change_str,\n"," coalesce(_change_color, '#919191') as change_color,\n"," coalesce(_usage_change_str, '') as usage_change_str,\n"," *\n"," from (\n"," select x_period_back, group_key, usage_usd, usage_change_percentage from usage_change_pivot\n"," union all\n"," select * from all_time_usage_pivot\n"," union all\n"," select * from all_time_total_usage_pivot\n"," )\n"," )\n","),\n","\n","pre_format_results AS (\n","-- query\n","select\n"," group_key,\n"," CASE WHEN :usage_toggle = 'Dollars' THEN concat('$', format_number(float(`Start to End date`), 0)) \n"," WHEN :usage_toggle = 'DBUs' THEN concat('', format_number(float(`Start to End date`), 0)) \n"," ELSE concat('$', format_number(float(`Start to End date`), 0)) \n"," END as `Start to End date`,\n"," float(`Start to End date`) as _all_time_usage_usd,\n"," 2 as _order,\n"," coalesce(`5 periods ago`, '0') as `5 periods ago`,\n"," coalesce(`4 periods ago`, '0') as `4 periods ago`,\n"," coalesce(`3 periods ago`, '0') as `3 periods ago`,\n"," coalesce(`2 periods ago`, '0') as `2 periods ago`,\n"," coalesce(`Last period`, '0') as `Last period`,\n"," coalesce(`Current period`, '0') as `Current period`\n","from union_usage_pivot\n","pivot (\n"," first(usage_info)\n"," for x_period_back in (\n"," 'Start to End date',\n"," '5 periods ago',\n"," '4 periods ago',\n"," '3 periods ago',\n"," '2 periods ago',\n"," 'Last period',\n"," 'Current period'\n"," )\n",")\n","union all\n","(\n"," select\n"," '' as group_key,\n"," concat('', date_format(:time_range.min, 'MMM dd yyyy'), ' - ', date_format(:time_range.max, 'MMM dd yyyy'), '') as `Start to End date`,\n"," null as _all_time_usage_usd,\n"," 1 as _order,\n"," concat('', date_format(5_periods_ago, 'MMM dd'), ' - ', date_format(date_add(4_periods_ago, -1), 'MMM dd'), '') as `5 periods ago`,\n"," concat('', date_format(4_periods_ago, 'MMM dd'), ' - ', date_format(date_add(3_periods_ago, -1), 'MMM dd'), '') as `4 periods ago`,\n"," concat('', date_format(3_periods_ago, 'MMM dd'), ' - ', date_format(date_add(2_periods_ago, -1), 'MMM dd'), '') as `3 periods ago`,\n"," concat('', date_format(2_periods_ago, 'MMM dd'), ' - ', date_format(date_add(last_period, -1), 'MMM dd'), '') as `2 periods ago`,\n"," concat('', date_format(last_period, 'MMM dd'), ' - ', date_format(date_add(current_period, -1), 'MMM dd'), '') as `Last period`,\n"," concat('', date_format(current_period, 'MMM dd'), ' - End Time', '') as `Current period`\n"," from period_info\n",")\n",")\n","\n","SELECT /*+ BROADCAST(gkr) */\n","r.*,\n"," CASE WHEN :enable_links_toggle = 'Enabled' THEN gkr.latest_asset_route ELSE NULL END AS latest_asset_route,\n"," gkr.latest_asset_owner,\n"," MAX(_all_time_usage_usd) OVER() AS max_usage,\n"," MIN(_all_time_usage_usd) OVER() AS min_usage,\n"," -- add data bars\n"," COALESCE(CONCAT(\n"," '
',\n"," '
',\n"," '',\n"," CASE WHEN :usage_toggle = 'Dollars' THEN '$' ELSE '' END,\n"," FORMAT_NUMBER(_all_time_usage_usd, 0), \n"," '
'\n"," ), `Start to End date`) AS usage_bar_html\n"," FROM pre_format_results AS r\n"," LEFT JOIN group_key_routes AS gkr ON r.group_key = gkr.rank_key\n","order by _order asc, _all_time_usage_usd desc"],"parameters":[{"displayName":"param_workspace","keyword":"param_workspace","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_time_key","keyword":"param_time_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Month"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"time_range","keyword":"time_range","dataType":"DATE","complexType":"RANGE","defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-12M/M"},"max":{"value":"now-1M/M"}}}},{"displayName":"product_category","keyword":"product_category","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"param_rank_key","keyword":"param_rank_key","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"warehouse_id"}]}}},{"displayName":"usage_toggle","keyword":"usage_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Dollars"}]}}},{"displayName":"param_top_n","keyword":"param_top_n","dataType":"INTEGER","defaultSelection":{"values":{"dataType":"INTEGER","values":[{"value":"10"}]}}},{"displayName":"include_remaining_assets","keyword":"include_remaining_assets","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Yes"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},{"displayName":"is_serverless","keyword":"is_serverless","dataType":"STRING","complexType":"MULTI","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"all"}]}}},{"displayName":"enable_links_toggle","keyword":"enable_links_toggle","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Enabled"}]}}}]},{"name":"976395d6","displayName":"contract_burndown","queryLines":["/*\n","\n","This section is a sample queries that shows how to build a contract burndown analysis given the following input params: \n","1. Contract Start Date\n","2. Contract End Date\n","3. Total Usage Amount of Contract\n","4. Total Support / Overhead amount of Contract\n","5. Discounts by product/sku list separataed by ;\n","\n","*/\n","\n","SET ansi_mode = True;\n","\n","WITH \n","-- calc list priced usage in USD\n","prices as (\n"," select coalesce(price_end_time, date_add(current_date, 1)) as coalesced_price_end_time, * , 'list' AS price_type\n"," from IDENTIFIER(:price_table)\n"," where currency_code = 'USD' \n","),\n","\n","contract_dates AS (\n"," SELECT \n"," explode(days) AS usage_date\n"," FROM (\n"," SELECT sequence(:contract_start_date::date, :contract_end_date::date) AS days\n"," )\n","),\n","\n","contract_burndown AS (\n"," SELECT \n"," *,\n"," SUM(daily_amount) OVER (ORDER BY usage_date) AS cumulative_estimated_contract_usage,\n"," try_divide(cumulative_estimated_contract_usage, total_usage_amount) AS estimated_contract_used\n"," FROM (\n"," SELECT\n"," contract_dates.usage_date,\n"," :usage_amount::float AS total_usage_amount,\n"," :support_amount::float AS total_support_amount,\n"," (:usage_amount::float / (SELECT COUNT(0) FROM contract_dates)) AS daily_amount\n"," FROM contract_dates\n"," )\n","),\n","\n","-- Now tag combos can be matched in 2 separate ways: key only, or the key=value pair if optionall provided\n","parsed_discounts_table AS (\n"," \n"," WITH split_data AS (\n"," SELECT explode(split(regexp_replace(upper(:discounts_by_product), '\\\\s+', ''), ';')) AS kv_pair\n"," FROM VALUES(1) AS dummy(x)\n"," ),\n"," clean_keys AS (\n"," SELECT \n"," ROW_NUMBER() OVER (ORDER BY kv_pair) AS order_id,\n"," split(kv_pair, '=')[0] AS product,\n"," try_cast(split(kv_pair, '=')[1] AS decimal(10,3)) AS discount,\n"," kv_pair AS combination,\n"," CASE WHEN contains(kv_pair, '=') THEN 1 ELSE 0 END AS ContainsValuePair\n"," FROM split_data\n"," )\n"," SELECT * FROM clean_keys WHERE ContainsValuePair = 1\n","),\n","\n","\n","list_priced_usd as (\n"," select\n"," coalesce(((1-COALESCE(discounts.discount, 0))* p.pricing.default)*usage_quantity, u.usage_quantity * p.pricing.default, 0) as usage_usd,\n"," u.*\n"," from system.billing.usage as u\n"," LEFT JOIN parsed_discounts_table AS discounts ON discounts.product = u.billing_origin_product\n"," left join prices as p\n"," on u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n","),\n","\n","\n","daily_usage AS (\n"," SELECT \n"," u.usage_date,\n"," SUM(coalesce(((1-COALESCE(discounts.discount, 0))* p.pricing.default)*usage_quantity, u.usage_quantity * p.pricing.default, 0)) AS DollarDBUs,\n"," SUM(u.usage_quantity * p.pricing.default) AS ListDollarDBUs,\n"," SUM(usage_quantity) AS DBUs\n"," FROM system.billing.usage AS u\n"," LEFT JOIN parsed_discounts_table AS discounts ON discounts.product = u.billing_origin_product\n"," LEFT JOIN prices as p\n"," on u.sku_name=p.sku_name\n"," and u.usage_unit=p.usage_unit\n"," and (u.usage_end_time between p.price_start_time and p.coalesced_price_end_time)\n"," GROUP BY u.usage_date\n","),\n","\n","clean_burn AS (\n","\n","SELECT \n","c.*,\n","u.usage_date AS u_usage_date,\n","u.DollarDBUs,\n","u.DBUs,\n","(u.DollarDBUs / c.total_usage_amount) * total_support_amount AS SupportDollars, -- Support is burned down in proportion to the usage\n","SUM(DollarDBUs) OVER (ORDER BY c.usage_date) AS cumulative_actual_spend,\n","try_divide(cumulative_actual_spend, total_usage_amount) AS actual_contract_used,\n","-- % completion Flags\n","CASE WHEN c.usage_date < current_date() \n"," THEN 'Past Usage'\n"," WHEN c.usage_date = current_date()\n"," THEN 'Today'\n"," WHEN c.usage_date > current_date() \n"," THEN 'Future'\n"," END AS TimePeriodFlag\n","FROM contract_burndown c\n","LEFT JOIN daily_usage u ON c.usage_date = u.usage_date\n","),\n","\n","with_flags AS (\n","SELECT \n","*,\n","SUM(SupportDollars) OVER (ORDER BY usage_date) AS cumulative_actual_spend_support,\n","CASE WHEN usage_date >= current_date()\n"," THEN current_date()::date\n"," ELSE usage_date::date\n"," END AS contract_active_date,\n","CASE WHEN cumulative_actual_spend > cumulative_estimated_contract_usage\n"," THEN 'Burning Above Run Rate'\n"," ELSE 'Within Run Rate'\n"," END AS RunRateFlag,\n","CASE WHEN cumulative_actual_spend <= total_usage_amount\n"," THEN 'Within Contract'\n"," ELSE 'Burst Usage'\n"," END AS BurstFlag,\n","CASE WHEN cumulative_actual_spend > total_usage_amount\n"," THEN 1\n"," ELSE 0\n"," END AS DidBurst,\n","MAX_BY(estimated_contract_used, usage_date) FILTER (WHERE TimePeriodFlag != 'Future') AS MostRecentEstimatedBurnProportion,\n","MAX_BY(actual_contract_used, usage_date) FILTER (WHERE TimePeriodFlag != 'Future') AS MostRecentActualBurnProportion\n","FROM clean_burn\n","GROUP BY ALL\n","),\n","\n","remaining_tcv AS (\n","SELECT \n","*,\n","COALESCE((SELECT MIN(usage_date) AS burst_date\n"," FROM with_flags \n"," WHERE DidBurst = 1)::date::string, 'Not Bursting') AS BurstDate,\n"," -- Contract remaining\n"," total_usage_amount - cumulative_actual_spend AS contract_usage_remaining,\n"," total_usage_amount + total_support_amount AS total_contract_value,\n"," (total_usage_amount + total_support_amount) - (cumulative_actual_spend + cumulative_actual_spend_support) AS contract_total_remaining\n","FROM with_flags \n",")\n","\n","SELECT \n","*\n","FROM remaining_tcv\n","--WHERE u_usage_date IS NOT NULL -- Will not look into future past current usage"],"parameters":[{"displayName":"contract_start_date","keyword":"contract_start_date","dataType":"DATE","defaultSelection":{"values":{"dataType":"DATE","values":[{"value":"2024-01-01T00:00:00.000"}]}}},{"displayName":"contract_end_date","keyword":"contract_end_date","dataType":"DATE","defaultSelection":{"values":{"dataType":"DATE","values":[{"value":"now/d"}]}}},{"displayName":"usage_amount","keyword":"usage_amount","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"3000000"}]}}},{"displayName":"support_amount","keyword":"support_amount","dataType":"DECIMAL","defaultSelection":{"values":{"dataType":"DECIMAL","values":[{"value":"500000"}]}}},{"displayName":"discounts_by_product","keyword":"discounts_by_product","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"sql=0.0;VECTOR_SEARCH=0.0;ALL_PURPOSE=0.0;MODEL_SERVING=0.0;JOBS=0.0;INTERACTIVE=0.0;LAKEHOUSE_MONITORING=0.0;DLT=0.0"}]}}},{"displayName":"price_table","keyword":"price_table","dataType":"STRING","defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}}]}],"pages":[{"name":"5879f9e7","displayName":"Usage Overview","layout":[{"widget":{"name":"573693eb","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081389a232fede31f38c91_group_key","query":{"datasetName":"078fbf24","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"group_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_group_key","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_group_key","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_group_key","query":{"datasetName":"e1dac524","parameters":[{"name":"param_group_key","keyword":"param_group_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"group_key","displayName":"group_key","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081389a232fede31f38c91_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_group_key"},{"parameterName":"param_group_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_group_key"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Product"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Group by Key","description":"Group usage data by one of the below dimensions"}}},"position":{"x":0,"y":2,"width":2,"height":2}},{"widget":{"name":"ba616645","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"Time"},"y":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"group_key","scale":{"type":"categorical"},"legend":{"hideTitle":true,"position":"right"},"displayName":"group_key"}},"frame":{"showTitle":true,"title":"Usage by Group Key Over Time"}}},"position":{"x":0,"y":14,"width":6,"height":8}},{"widget":{"name":"1f7ff923","queries":[{"name":"main_query","query":{"datasetName":"f14c46e1","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Key","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":1,"title":"Start to End date","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":2,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":9,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":10,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":11,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":12,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage by Group Period Over Period"}}},"position":{"x":0,"y":31,"width":6,"height":13}},{"widget":{"name":"e4d3cb0e","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"time_window_string","expression":"`time_window_string`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"sum(usage_usd)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"bold":true,"color":"#00A972","fontSize":32},"displayName":"Sum of usage_usd"},"target":{"fieldName":"time_window_string","style":{"color":{"themeColorType":"fontColor"},"italic":true,"fontSize":14},"displayName":"time_window_string"}},"frame":{"showTitle":true,"title":"Total Usage","showDescription":false,"description":"(# of usage periods)"}}},"position":{"x":2,"y":2,"width":2,"height":2}},{"widget":{"name":"37e96b43","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"usage_type","expression":"`usage_type`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"area","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"Time"},"y":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"usage_type","scale":{"type":"categorical","mappings":[{"value":"Actuals","color":"#077A9D"},{"value":"Forecast","color":"#919191"}]},"legend":{"hideTitle":true},"displayName":"usage_type"}},"frame":{"showTitle":true,"title":"Total Usage Over Time","showDescription":true,"description":"*Does not cross filter, use global filters or look at the below visual to look at cross filtered values"},"mark":{"colors":["#077A9D",{"themeColorType":"visualizationColors","position":2},{"themeColorType":"visualizationColors","position":3},{"themeColorType":"visualizationColors","position":4},{"themeColorType":"visualizationColors","position":5},{"themeColorType":"visualizationColors","position":6},{"themeColorType":"visualizationColors","position":7},{"themeColorType":"visualizationColors","position":8},{"themeColorType":"visualizationColors","position":9},{"themeColorType":"visualizationColors","position":10}]}}},"position":{"x":2,"y":6,"width":4,"height":8}},{"widget":{"name":"117de0ec","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"},{"name":"group_key","expression":"`group_key`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd_dynamic)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage"},"y":{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"hideTitle":true,"title":"Group Key"},"displayName":"Workspace"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key"},"mark":{"colors":["#077A9D",{"themeColorType":"visualizationColors","position":2},{"themeColorType":"visualizationColors","position":3},{"themeColorType":"visualizationColors","position":4},{"themeColorType":"visualizationColors","position":5},{"themeColorType":"visualizationColors","position":6},{"themeColorType":"visualizationColors","position":7},{"themeColorType":"visualizationColors","position":8},{"themeColorType":"visualizationColors","position":9},{"themeColorType":"visualizationColors","position":10}]}}},"position":{"x":0,"y":4,"width":2,"height":10}},{"widget":{"name":"edeb1728","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"time_window_string","expression":"`time_window_string`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"filters":[{"expression":"`usage_type` IN ('Forecast')"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"sum(usage_usd_dynamic)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"bold":true,"color":{"themeColorType":"visualizationColors","position":9},"fontSize":32},"displayName":"Sum of usage_usd_dynamic"},"target":{"fieldName":"time_window_string","style":{"color":{"themeColorType":"fontColor"},"italic":true,"fontSize":14},"displayName":"time_window_string"}},"frame":{"showTitle":true,"title":"Forecasted Usage","showDescription":true,"description":"*Forecast #s do not cross filter, use global filters"}}},"position":{"x":4,"y":2,"width":2,"height":2}},{"widget":{"name":"45326bef","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"time_period","expression":"`time_period`"},{"name":"measure(period_run_rate)","expression":"MEASURE(`period_run_rate`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"measure(period_run_rate)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"fontSize":24},"displayName":"period_run_rate"},"target":{"fieldName":"time_period","style":{"fontSize":18,"color":{"themeColorType":"fontColor"},"italic":true},"displayName":"time_period"}},"frame":{"showTitle":true,"title":"Run Rate Usage","showDescription":true,"description":"(period type)"}}},"position":{"x":2,"y":4,"width":2,"height":2}},{"widget":{"name":"3ead13cd","queries":[{"name":"main_query","query":{"datasetName":"e1dac524","fields":[{"name":"measure(forecast_percent_increase)","expression":"MEASURE(`forecast_percent_increase`)"},{"name":"measure(forecasted_run_rate)","expression":"MEASURE(`forecasted_run_rate`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"counter","encodings":{"value":{"fieldName":"measure(forecasted_run_rate)","format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"style":{"fontSize":24},"displayName":"forecasted_run_rate"},"target":{"fieldName":"measure(forecast_percent_increase)","style":{"color":{"themeColorType":"visualizationColors","position":3},"fontSize":20,"rules":[{"condition":{"operator":">=","operand":{"type":"data-value","value":"0.2"}},"color":{"themeColorType":"visualizationColors","position":4}},{"condition":{"operator":">=","operand":{"type":"data-value","value":"0.1"}},"color":{"themeColorType":"visualizationColors","position":2}}]},"format":{"type":"number-percent","decimalPlaces":{"type":"max","places":0}},"displayName":"forecast_percent_increase"}},"frame":{"showTitle":true,"title":"Forecasted Run Rate","showDescription":true,"description":"(percent increase/decrease from actual run rate)"}}},"position":{"x":4,"y":4,"width":2,"height":2}},{"widget":{"name":"68e8b4d4","queries":[{"name":"main_query","query":{"datasetName":"6b9e03f6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"workspace_norm","expression":"`workspace_norm`"},{"name":"sum(usage_usd_dynamic)","expression":"SUM(`usage_usd_dynamic`)"}],"cubeGroupingSets":{"sets":[{"fieldNames":["group_key"]},{"fieldNames":["workspace_norm"]}]},"disaggregated":false,"orders":[{"direction":"ASC","expression":"`group_key`"},{"direction":"ASC","expression":"`workspace_norm`"}]}}],"spec":{"version":3,"widgetType":"pivot","encodings":{"rows":[{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"cell-reversed","field":{"index":0}}},"displayName":"Group Key"}],"columns":[{"fieldName":"workspace_norm","scale":{"type":"categorical","sort":{"by":"cell-reversed","field":{"index":0}}},"displayName":"Workspace"}],"cell":{"type":"multi-cell","fields":[{"fieldName":"sum(usage_usd_dynamic)","cellType":"text","style":{"type":"color-scale","backgroundColor":{"scale":{"type":"quantitative","colorRamp":{"mode":"scheme","scheme":"greenblue"}}}},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"exact","places":2},"hideGroupSeparator":false},"displayName":"Usage"}]}},"frame":{"showTitle":true,"title":"Usage by Workspace and Group Key (export-friendly)"}}},"position":{"x":0,"y":22,"width":6,"height":9}},{"widget":{"name":"838a3112","multilineTextboxSpec":{"lines":["# **Usage Overview**\n","---\n","\n","**Analyze usage for your account by product, workspace, and identify trends over time.**"]}},"position":{"x":0,"y":0,"width":6,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"213392c8","displayName":"Usage Overview - Top N","layout":[{"widget":{"name":"1d94f140","queries":[{"name":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1abab4e68f7a89038b48_param_top_n","query":{"datasetName":"03f6453c","parameters":[{"name":"param_top_n","keyword":"param_top_n"}],"disaggregated":false}},{"name":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1ace912916cfeb25b061_param_top_n","query":{"datasetName":"21de1797","parameters":[{"name":"param_top_n","keyword":"param_top_n"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_top_n","queryName":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1abab4e68f7a89038b48_param_top_n"},{"parameterName":"param_top_n","queryName":"parameter_dashboards/01efa6a8cbda13a395899f5029c68024/datasets/01efa6a8cbda1ace912916cfeb25b061_param_top_n"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Top N"}}},"position":{"x":0,"y":5,"width":1,"height":2}},{"widget":{"name":"c42e90c1","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43100eb776beba94bec7f6_rank_key","query":{"datasetName":"f768db5b","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"rank_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43199e87af012e00363f6b_param_rank_key","query":{"datasetName":"03f6453c","parameters":[{"name":"param_rank_key","keyword":"param_rank_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431a16881bca8766dd4f60_param_rank_key","query":{"datasetName":"21de1797","parameters":[{"name":"param_rank_key","keyword":"param_rank_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"rank_key","displayName":"rank_key","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43100eb776beba94bec7f6_rank_key"},{"parameterName":"param_rank_key","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43199e87af012e00363f6b_param_rank_key"},{"parameterName":"param_rank_key","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431a16881bca8766dd4f60_param_rank_key"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Rank by"}}},"position":{"x":1,"y":5,"width":1,"height":2}},{"widget":{"name":"eeaae9bf","multilineTextboxSpec":{"lines":[" Select `workspace`, `run_as`, or any field from [usage_metadata](https://docs.databricks.com/en/admin/system-tables/billing.html#usage-metadata) to rank the usage. This aggregates the top N usage that has a value for the selected key. For example, selecting 'job_id' will aggregate the usage for the top N jobs. Selecting 'warehouse_id' will aggregate usage by top N warehouses. This is NOT mean to sum up exactly to total usage (as in the Usage Overview tab), as it is a top N analysis by key only, and certain keys can contain multiple SKUs (i.e. a job_id can use JOBS / SQL WAREHOUSES / ALL_PURPOSE compute, etc.)"]}},"position":{"x":0,"y":3,"width":6,"height":2}},{"widget":{"name":"afbd3ae2","queries":[{"name":"main_query","query":{"datasetName":"03f6453c","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"filters":[{"expression":"`rank_key` IN (`rank_key`) OR TRUE"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","axis":{"hideTitle":true},"scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"color":{"fieldName":"rank_key","legend":{"position":"right","title":"Top N"},"scale":{"mappings":[{"color":"#ffe4ba","value":""},{"color":"#dedede","value":null},{"value":"","color":"#919191"}],"type":"categorical"},"displayName":"Top N"}},"frame":{"showTitle":true,"title":"Top N Usage by Rank Key Over Time"}}},"position":{"x":0,"y":7,"width":6,"height":8}},{"widget":{"name":"a18a16ab","queries":[{"name":"main_query","query":{"datasetName":"21de1797","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"},{"name":"latest_asset_route","expression":"`latest_asset_route`"}],"filters":[{"expression":"`group_key` IN (`group_key`) OR TRUE"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ latest_asset_route }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"link","visible":true,"order":0,"title":"Top N Billable Objects","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":1,"title":"Usage","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":2,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":9,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":10,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":11,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":12,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"latest_asset_route","type":"string","displayAs":"string","order":13,"title":"latest_asset_route","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"latest_asset_owner","type":"string","displayAs":"string","order":14,"title":"latest_asset_owner","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage By Group Period Over Period"}}},"position":{"x":0,"y":25,"width":6,"height":12}},{"widget":{"name":"79ae85d0","queries":[{"name":"main_query","query":{"datasetName":"03f6453c","fields":[{"name":"rank_key","expression":"`rank_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"workspace","expression":"`workspace`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"workspace","axis":{"hideTitle":true},"scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"workspace"},"color":{"fieldName":"rank_key","legend":{"position":"right","title":"Top N"},"scale":{"mappings":[{"color":"#ffe4ba","value":""},{"color":"#dedede","value":null},{"value":"","color":"#919191"}],"type":"categorical"},"displayName":"Top N"}},"frame":{"showTitle":true,"title":"Top N Usage by Rank"}}},"position":{"x":0,"y":15,"width":6,"height":8}},{"widget":{"name":"9334c2b5","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed319be9f1416731ae9ad37_toggle","query":{"datasetName":"bb990f09","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b0a8694ec502e04b822_include_remaining_assets","query":{"datasetName":"03f6453c","parameters":[{"name":"include_remaining_assets","keyword":"include_remaining_assets"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b1f903d9f4747035cc0_include_remaining_assets","query":{"datasetName":"21de1797","parameters":[{"name":"include_remaining_assets","keyword":"include_remaining_assets"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed319be9f1416731ae9ad37_toggle"},{"parameterName":"include_remaining_assets","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b0a8694ec502e04b822_include_remaining_assets"},{"parameterName":"include_remaining_assets","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31b1f903d9f4747035cc0_include_remaining_assets"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"No"}]}}},"frame":{"showTitle":true,"title":"Include Remaining Billable Objects"}}},"position":{"x":2,"y":5,"width":1,"height":2}},{"widget":{"name":"9648b6b6","multilineTextboxSpec":{"lines":[" !Billable Object Hyperlinks! If hyperlinks are enabled (in the global filters), the user can click on most Billable Object Ids to go to that object. To do this, the user MUST have read/access permission to the underlying asset. This is best used with workspace admins."]}},"position":{"x":0,"y":23,"width":6,"height":2}},{"widget":{"name":"e063fd58","multilineTextboxSpec":{"lines":["# **Usage Overview: Top N Usage By Key**\n","---\n","\n","**Quickly identify top N drivers of usage across your account**\n","---\n"," This section ranks Top N usage by any selected billable object such as job_id, warehouse_id, cluster_id, endpoint_id, etc. This helps narrow down specific top drivers of cost for a particular product area. i.e. 'Show me the top 10 job_ids that are driving my spend on JOBS compute'."]}},"position":{"x":0,"y":0,"width":6,"height":3}},{"widget":{"name":"4731089e","multilineTextboxSpec":{"lines":[" The 'Include Remaining Billable Objects' filter allows you to show or not show the aggregated usage outside of the top N objects. If 'Yes' is selected, you will the the top 10 objects as well as a single category of aggregated usage for all remaining objects that are not in the top N. I you select top 10 by 'warehouse_id' then you will see the top 10 warehouses as well as a single bucket called 'REMANING OBJECTS' that is the total usage for all remaining warehouses. "]}},"position":{"x":3,"y":5,"width":3,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"096c54ee","displayName":"Usage Analysis - Tag Matching","layout":[{"widget":{"name":"bd6547ea","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries","query":{"datasetName":"437db86b","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries","query":{"datasetName":"450b2674","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Tag search filter","description":"; separated list of key=value pairs to search, with values as optional (eg: env=prod;budget)"}}},"position":{"x":0,"y":4,"width":2,"height":2}},{"widget":{"name":"7fe3bdc0","queries":[{"name":"dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a9018d89d75c7fb3990c860_toggle","query":{"datasetName":"cd4e3c97","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901a779a1f582d5744be5f_param_show_tag_mismatch","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901abf9e8cee0ddb71ef55_param_show_tag_mismatch","query":{"datasetName":"437db86b","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901af096142371b0cec5f2_param_show_tag_mismatch","query":{"datasetName":"450b2674","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a9018d89d75c7fb3990c860_toggle"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901a779a1f582d5744be5f_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901abf9e8cee0ddb71ef55_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f025217a90137caab1fdd91dda8bf2/datasets/01f025217a901af096142371b0cec5f2_param_show_tag_mismatch"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Usage Match Filter","description":"show all, matched, or only unmatched usage"}}},"position":{"x":2,"y":4,"width":1,"height":2}},{"widget":{"name":"f57c064d","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","axis":{"hideTitle":true},"scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","axis":{"title":"Usage"},"scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage ($)"},"color":{"fieldName":"group_key","legend":{"position":"bottom","title":"Tag Key-Value Pairs","hideTitle":true},"scale":{"mappings":[{"value":"","color":"#AB4057"},{"value":"","color":"#077A9D"},{"value":"","color":"#00A972"},{"value":"Photon","color":"#00A972"},{"value":"Spark","color":"#077A9D"},{"value":"","color":"#AB4057"},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}],"type":"categorical"},"displayName":"Tags"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key Over Time"}}},"position":{"x":2,"y":12,"width":4,"height":8}},{"widget":{"name":"d817ee65","queries":[{"name":"main_query","query":{"datasetName":"437db86b","fields":[{"name":"group_key_html","expression":"`group_key_html`"},{"name":"group_key","expression":"`group_key`"},{"name":"usage_bar_html","expression":"`usage_bar_html`"},{"name":"Current period","expression":"`Current period`"},{"name":"Last period","expression":"`Last period`"},{"name":"2 periods ago","expression":"`2 periods ago`"},{"name":"3 periods ago","expression":"`3 periods ago`"},{"name":"4 periods ago","expression":"`4 periods ago`"},{"name":"5 periods ago","expression":"`5 periods ago`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"group_key_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Tags","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":0,"displayName":"group_key_html"},{"fieldName":"group_key","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":false,"order":1,"title":"Tag Key-Value Pairs","allowSearch":true,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"group_key"},{"fieldName":"usage_bar_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":2,"title":"Start to End date","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_bar_html"},{"fieldName":"Current period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":4,"title":"Current period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Current period"},{"fieldName":"Last period","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"Last period","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"Last period"},{"fieldName":"2 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"2 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"2 periods ago"},{"fieldName":"3 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":7,"title":"3 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"3 periods ago"},{"fieldName":"4 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"4 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"4 periods ago"},{"fieldName":"5 periods ago","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":9,"title":"5 periods ago","allowSearch":false,"alignContent":"center","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"5 periods ago"}]},"invisibleColumns":[{"dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"Start to End date","type":"string","displayAs":"string","order":3,"title":"Start to End date","allowSearch":false,"alignContent":"right","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_all_time_usage_usd","type":"float","displayAs":"number","order":10,"title":"_all_time_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"_order","type":"integer","displayAs":"number","order":11,"title":"_order","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage","type":"float","displayAs":"number","order":12,"title":"max_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0.00","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage","type":"float","displayAs":"number","order":13,"title":"min_usage","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":20,"paginationSize":"default","condensed":false,"withRowNumber":false,"frame":{"showDescription":false,"showTitle":true,"title":"Usage by Group Period Over Period (*Note: does not cross filter with above visuals - use top filters*)"}}},"position":{"x":0,"y":30,"width":6,"height":11}},{"widget":{"name":"dbdc3a3d","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"IsMatchedClean","expression":"`IsMatchedClean`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"title":"Is Search Match?","hideTitle":true},"displayName":"Is Matched?"},"color":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","mappings":[{"value":"","color":"#077A9D"},{"value":"","color":"#AB4057"}]},"legend":{"hide":true,"hideTitle":true},"displayName":"IsMatchedClean"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Tag Match"}}},"position":{"x":0,"y":6,"width":2,"height":6}},{"widget":{"name":"1d3b9e4e","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"IsMatchedClean","expression":"`IsMatchedClean`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"group_key","expression":"`group_key`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Usage"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"none","decimalPlaces":{"type":"max","places":0}},"displayName":"Usage"},"y":{"fieldName":"group_key","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"axis":{"labelAngle":90,"hideTitle":true},"displayName":"BIlling Origin Product"},"color":{"fieldName":"IsMatchedClean","scale":{"type":"categorical","mappings":[{"value":"","color":"#00A972"},{"value":"","color":"#AB4057"},{"value":"","color":"#077A9D"},{"value":"","color":"#AB4057"},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hide":false,"hideTitle":true},"displayName":"IsMatchedClean"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Group Key"}}},"position":{"x":0,"y":12,"width":2,"height":8}},{"widget":{"name":"93d10194","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"billing_origin_product","expression":"`billing_origin_product`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"billing_origin_product","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Product"},"color":{"fieldName":"group_key","scale":{"type":"categorical","mappings":[{"value":"","color":{"themeColorType":"visualizationColors","position":6}},{"value":"","color":{"themeColorType":"visualizationColors","position":1}},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hideTitle":true},"displayName":"Product"}},"frame":{"showTitle":true,"title":"Usage by Product & Group Key"}}},"position":{"x":0,"y":20,"width":3,"height":10}},{"widget":{"name":"a50cc13a","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4310d2a7469a2dbfb64560_group_key","query":{"datasetName":"988516d6","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"group_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_tag_group","query":{"datasetName":"d61a4eeb","parameters":[{"name":"tag_group","keyword":"tag_group"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_tag_group","query":{"datasetName":"437db86b","parameters":[{"name":"tag_group","keyword":"tag_group"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"group_key","displayName":"group_key","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4310d2a7469a2dbfb64560_group_key"},{"parameterName":"tag_group","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_tag_group"},{"parameterName":"tag_group","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_tag_group"}]},"frame":{"showTitle":true,"title":"Group by"}}},"position":{"x":3,"y":4,"width":2,"height":2}},{"widget":{"name":"e90d7185","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"time_key","expression":"`time_key`"},{"name":"avg(tag_match_rate)","expression":"AVG(`tag_match_rate`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"line","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"axis":{"hideTitle":true},"displayName":"time_key"},"y":{"fieldName":"avg(tag_match_rate)","scale":{"type":"quantitative"},"format":{"type":"number-percent","decimalPlaces":{"type":"max","places":3}},"axis":{"title":"Match Rate"},"displayName":"Match Rate"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Tag Match Rate Over Time"}}},"position":{"x":2,"y":6,"width":4,"height":6}},{"widget":{"name":"e421ac73","multilineTextboxSpec":{"lines":["## Tag Popularity\n","-----\n","\n"," This section shows what the most commonly used tags are to aid in searching. Tag Popularity is based on the % of usage that is tagged. The more popular a tag is, the more usage $ that tag will cover. This section is NOT additive by usage, as usage records can have multiple tags per record. \n","-----"]}},"position":{"x":0,"y":41,"width":6,"height":3}},{"widget":{"name":"9be1cda1","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431bc29d7355e147d8ef25_toggle","query":{"datasetName":"8b6b5367","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_tag_aggregate_by","query":{"datasetName":"a28f5b19","parameters":[{"name":"top_tag_aggregate_by","keyword":"top_tag_aggregate_by"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_tag_aggregate_by","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_tag_aggregate_by"},{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431bc29d7355e147d8ef25_toggle"}]},"frame":{"showTitle":true,"title":"Rank Top N Tags By"}}},"position":{"x":2,"y":44,"width":2,"height":2}},{"widget":{"name":"c4d3593b","queries":[{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_n_tags","query":{"datasetName":"a28f5b19","parameters":[{"name":"top_n_tags","keyword":"top_n_tags"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_n_tags","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_top_n_tags"}]},"frame":{"showTitle":true,"title":"Top N Tag Number"}}},"position":{"x":4,"y":44,"width":2,"height":2}},{"widget":{"name":"4838e10f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"},{"name":"time_key","expression":"`time_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"time_key","scale":{"type":"temporal"},"displayName":"time_key"},"y":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Popularity"},"displayName":"Usage"},"color":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical"},"displayName":"Tag"}},"mark":{"layout":"percent-stack"}}},"position":{"x":2,"y":46,"width":4,"height":8}},{"widget":{"name":"4d9bf13f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"workspace","expression":"`workspace`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"displayName":"Popularity"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"workspace","scale":{"type":"categorical"},"legend":{"position":"bottom"},"displayName":"Workspace"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Top Tags Used By Workspace"}}},"position":{"x":3,"y":54,"width":3,"height":9}},{"widget":{"name":"b16984be","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"displayName":"Popularity"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"billing_origin_product","scale":{"type":"categorical"},"legend":{"position":"bottom"},"displayName":"Product"},"label":{"show":false}},"frame":{"showTitle":true,"title":"Top Tags Used By Product"}}},"position":{"x":0,"y":54,"width":3,"height":9}},{"widget":{"name":"0fd2c4d0","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43111497b24acee72ebf13_toggle","query":{"datasetName":"2b5e3641","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_normalize_case","query":{"datasetName":"d61a4eeb","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_normalize_case","query":{"datasetName":"437db86b","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_normalize_case","query":{"datasetName":"450b2674","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_normalize_case","query":{"datasetName":"a28f5b19","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb43111497b24acee72ebf13_toggle"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431b5ebc224be79b5c32d8_normalize_case"}]},"frame":{"showDescription":true,"showTitle":true,"title":"Normalize Tags?","description":"Cleans spaces & casing"}}},"position":{"x":5,"y":4,"width":1,"height":2}},{"widget":{"name":"9d07a1ad","queries":[{"name":"main_query","query":{"datasetName":"d61a4eeb","fields":[{"name":"group_key","expression":"`group_key`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"},{"name":"workspace_id","expression":"`workspace_id`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"format":{"type":"number-currency","currencyCode":"USD","abbreviation":"compact","decimalPlaces":{"type":"max","places":2}},"displayName":"Usage"},"y":{"fieldName":"workspace_id","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Workspace"},"color":{"fieldName":"group_key","scale":{"type":"categorical","mappings":[{"value":"","color":{"themeColorType":"visualizationColors","position":6}},{"value":"","color":{"themeColorType":"visualizationColors","position":1}},{"value":"","color":{"themeColorType":"visualizationColors","position":3}}]},"legend":{"hideTitle":true},"displayName":"Product"}},"frame":{"showTitle":true,"title":"Usage by Workspace & Group Key"}}},"position":{"x":3,"y":20,"width":3,"height":10}},{"widget":{"name":"d018a853","multilineTextboxSpec":{"lines":["# **Usage Analysis: Tag Matching**\n","---\n","\n","**Analyze usage with your own tagging policies. Select tags to identify usage that matches (or doesnt match) those tags, and trend over time by tag.**"]}},"position":{"x":0,"y":0,"width":6,"height":2}},{"widget":{"name":"c466a6a0","multilineTextboxSpec":{"lines":[" When you search for a set of tags in the search bar, all usage will be classified into 'NOT TAGGED', 'NO TAG MATCH', or 'MATCHED'. \n"," - **NOT TAGGED** - means the usage is not tagged at all, which by default will never match a tag search. \n","- **NO TAG MATCH** - means the usage is tagged, but not with the tags you are searching on\n","- **MATCHED** - means that usage includes all tags you are searching on"]}},"position":{"x":0,"y":2,"width":6,"height":2}},{"widget":{"name":"a7579c4f","queries":[{"name":"main_query","query":{"datasetName":"a28f5b19","fields":[{"name":"dynamic_tag_rollup","expression":"`dynamic_tag_rollup`"},{"name":"sum(usage_usd)","expression":"SUM(`usage_usd`)"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"bar","encodings":{"x":{"fieldName":"sum(usage_usd)","scale":{"type":"quantitative"},"axis":{"title":"Popularity By Usage"},"displayName":"Usage"},"y":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical","sort":{"by":"x-reversed"}},"displayName":"Tag"},"color":{"fieldName":"dynamic_tag_rollup","scale":{"type":"categorical"},"displayName":"Tag"}},"frame":{"showTitle":true,"title":"Top N Tags By Popularity"},"mark":{"layout":"stack"}}},"position":{"x":0,"y":44,"width":2,"height":10}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"e94f9247","displayName":"Usage Analysis - Top Objects","layout":[{"widget":{"name":"7c65e880","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_asset_id","query":{"datasetName":"450b2674","fields":[{"name":"asset_id","expression":"`asset_id`"},{"name":"asset_id_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"asset_id","displayName":"asset_id","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_asset_id"}]},"frame":{"showTitle":true,"title":"Billable Object Id"}}},"position":{"x":2,"y":5,"width":2,"height":2}},{"widget":{"name":"fc3ff2e9","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_usage_owner","query":{"datasetName":"450b2674","fields":[{"name":"usage_owner","expression":"`usage_owner`"},{"name":"usage_owner_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"usage_owner","displayName":"usage_owner","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_usage_owner"}]},"frame":{"showTitle":true,"title":"Billable Object User"}}},"position":{"x":4,"y":5,"width":2,"height":2}},{"widget":{"name":"454d51c4","queries":[{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_top_n_asset","query":{"datasetName":"450b2674","parameters":[{"name":"top_n_asset","keyword":"top_n_asset"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"top_n_asset","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_top_n_asset"}]},"frame":{"showTitle":true,"title":"Top N Billable Object Ids","showDescription":true,"description":"Filter for Top N assets"}}},"position":{"x":0,"y":3,"width":1,"height":2}},{"widget":{"name":"22a280b4","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_DaysSinceMostRecentUsage","query":{"datasetName":"450b2674","fields":[{"name":"min(DaysSinceMostRecentUsage)","expression":"MIN(`DaysSinceMostRecentUsage`)"},{"name":"max(DaysSinceMostRecentUsage)","expression":"MAX(`DaysSinceMostRecentUsage`)"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"range-slider","encodings":{"fields":[{"fieldName":"DaysSinceMostRecentUsage","displayName":"DaysSinceMostRecentUsage","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f03290aed31af189a7c6484a95d936_DaysSinceMostRecentUsage"}]},"selection":{"defaultSelection":{"range":{"dataType":"INTEGER","min":{"value":""},"max":{"value":"30"}}}},"frame":{"showTitle":true,"title":"Days Since Last Usage","showDescription":true,"description":"Filter out assets that are no longer used recently"}}},"position":{"x":0,"y":5,"width":2,"height":2}},{"widget":{"name":"2e0ec97a","queries":[{"name":"main_query","query":{"datasetName":"450b2674","fields":[{"name":"MatchedKey_html","expression":"`MatchedKey_html`"},{"name":"MostRecentIsMatched","expression":"`MostRecentIsMatched`"},{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"asset_id","expression":"`asset_id`"},{"name":"MostRecentAssetName","expression":"`MostRecentAssetName`"},{"name":"is_object_deleted","expression":"`is_object_deleted`"},{"name":"usage_dollars_html","expression":"`usage_dollars_html`"},{"name":"percent_pop_change","expression":"`percent_pop_change`"},{"name":"heat_color_html","expression":"`heat_color_html`"},{"name":"workspace_id","expression":"`workspace_id`"},{"name":"MostRecentUsageDate","expression":"`MostRecentUsageDate`"},{"name":"usage_owner","expression":"`usage_owner`"},{"name":"EarliestUsageDate","expression":"`EarliestUsageDate`"},{"name":"MostRecentTagsOnAsset","expression":"`MostRecentTagsOnAsset`"},{"name":"MostRecentUsageMetadata","expression":"`MostRecentUsageMetadata`"},{"name":"MostRecentProductFeatures","expression":"`MostRecentProductFeatures`"},{"name":"usage_type","expression":"`usage_type`"},{"name":"asset_url_router","expression":"`asset_url_router`"}],"disaggregated":true}}],"spec":{"version":1,"widgetType":"table","encodings":{"columns":[{"fieldName":"MatchedKey_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":0,"title":"Is Matched","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Is most recent usage of this asset matching the search pattern","defaultColumnWidth":130,"displayName":"MatchedKey_html"},{"fieldName":"MostRecentIsMatched","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":false,"order":1,"title":"Is Matched","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Is the Most recent usage of this asset correctly matched?","displayName":"MostRecentIsMatched"},{"fieldName":"billing_origin_product","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":3,"title":"Product","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":150,"displayName":"billing_origin_product"},{"fieldName":"asset_id","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ asset_url_router }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"link","visible":true,"order":4,"title":"Billable Object Id","allowSearch":true,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"The id of a cluster, job, warehouse, pipeline, etc. that the usage originates from","cellFormat":{"default":{"foregroundColor":null},"rules":[]},"defaultColumnWidth":200,"displayName":"asset_id"},{"fieldName":"MostRecentAssetName","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":5,"title":"Object Name","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"Name of cluster or warehouse from system.compute/jobs","defaultColumnWidth":150,"displayName":"MostRecentAssetName"},{"fieldName":"is_object_deleted","numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":6,"title":"Is Deleted?","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"This works for jobs, warehouses, clusters, and pipelines only. ","cellFormat":{"default":{"foregroundColor":{"themeColorType":"visualizationColors","position":5}},"rules":[{"if":{"column":"is_object_deleted","fn":"=","literal":"active"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":7}}},{"if":{"column":"is_object_deleted","fn":"=","literal":"deleted"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":6}}},{"if":{"column":"is_object_deleted","fn":"=","literal":"unknown"},"value":{"foregroundColor":{"themeColorType":"visualizationColors","position":9}}}]},"defaultColumnWidth":140,"displayName":"is_object_deleted"},{"fieldName":"usage_dollars_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":8,"title":"Usage $","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":200,"displayName":"usage_dollars_html"},{"fieldName":"percent_pop_change","numberFormat":"%","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"decimal","displayAs":"number","visible":true,"order":10,"title":"% Change Since Last Period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"description":"% change since last period","cellFormat":{"default":{"foregroundColor":null},"rules":[{"if":{"column":"percent_pop_change","fn":">=","literal":"0"},"value":{"foregroundColor":"#00A972"}},{"if":{"column":"percent_pop_change","fn":"<","literal":"0"},"value":{"foregroundColor":"#FF3621"}}]},"displayName":"percent_pop_change"},{"fieldName":"heat_color_html","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":11,"title":"Days Since Last Usage","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"defaultColumnWidth":201,"displayName":"heat_color_html"},{"fieldName":"workspace_id","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":13,"title":"Workspace Id","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"workspace_id"},{"fieldName":"MostRecentUsageDate","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"date","displayAs":"datetime","visible":true,"order":14,"title":"Most Recent Usage Date","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentUsageDate"},{"fieldName":"usage_owner","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":17,"title":"Object Runner / Owner","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_owner"},{"fieldName":"EarliestUsageDate","dateTimeFormat":"YYYY-MM-DD","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"date","displayAs":"datetime","visible":true,"order":19,"title":"Earliest Usage Date","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"EarliestUsageDate"},{"fieldName":"MostRecentTagsOnAsset","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":20,"title":"Most Recent Tags","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentTagsOnAsset"},{"fieldName":"MostRecentUsageMetadata","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":21,"title":"Most Recent Usage Metadata","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentUsageMetadata"},{"fieldName":"MostRecentProductFeatures","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"complex","displayAs":"json","visible":true,"order":22,"title":"Most Recent Product Features","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"MostRecentProductFeatures"},{"fieldName":"usage_type","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"type":"string","displayAs":"string","visible":true,"order":24,"title":"usage_type","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"displayName":"usage_type"}]},"invisibleColumns":[{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"MostRecentTagKeyValuePairs","type":"string","displayAs":"string","order":2,"title":"MostRecentTagKeyValuePairs","allowSearch":false,"alignContent":"left","allowHTML":true,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"asset_type","type":"string","displayAs":"string","order":7,"title":"Object Type","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"$ ,0.","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"TotalDollarsUsage","type":"decimal","displayAs":"number","order":9,"title":"Usage ($)","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false,"cellFormat":{"default":{"foregroundColor":null},"rules":[]}},{"numberFormat":",.","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"TotalDBUUsageQuantity","type":"decimal","displayAs":"number","order":12,"title":"Usage (DBUs)","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"DaysSinceMostRecentUsage","type":"integer","displayAs":"number","order":15,"title":"Days Since Last Use","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"asset_url_router","type":"string","displayAs":"string","order":16,"title":"asset_url_router","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"IsClassifiedIntoAsset","type":"string","displayAs":"string","order":18,"title":"IsClassifiedIntoAsset","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"clean_ui_is_matched","type":"string","displayAs":"string","order":23,"title":"clean_ui_is_matched","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage_dollars","type":"decimal","displayAs":"number","order":25,"title":"max_usage_dollars","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage_dollars","type":"decimal","displayAs":"number","order":26,"title":"min_usage_dollars","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"max_usage_days","type":"integer","displayAs":"number","order":27,"title":"max_usage_days","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"min_usage_days","type":"integer","displayAs":"number","order":28,"title":"min_usage_days","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"IsServerless","type":"string","displayAs":"string","order":29,"title":"IsServerless","allowSearch":false,"alignContent":"left","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"dateTimeFormat":"YYYY-MM-DD HH:mm:ss.SSS","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"current_period","type":"datetime","displayAs":"datetime","order":30,"title":"current_period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"dateTimeFormat":"YYYY-MM-DD HH:mm:ss.SSS","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"last_period","type":"datetime","displayAs":"datetime","order":31,"title":"last_period","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"current_period_usage_usd","type":"decimal","displayAs":"number","order":32,"title":"current_period_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"last_period_usage_usd","type":"decimal","displayAs":"number","order":33,"title":"last_period_usage_usd","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false},{"numberFormat":"0","booleanValues":["false","true"],"imageUrlTemplate":"{{ @ }}","imageTitleTemplate":"{{ @ }}","imageWidth":"","imageHeight":"","linkUrlTemplate":"{{ @ }}","linkTextTemplate":"{{ @ }}","linkTitleTemplate":"{{ @ }}","linkOpenInNewTab":true,"name":"top_n_asset","type":"integer","displayAs":"number","order":34,"title":"top_n_asset","allowSearch":false,"alignContent":"right","allowHTML":false,"highlightLinks":false,"useMonospaceFont":false,"preserveWhitespace":false}],"allowHTMLByDefault":false,"itemsPerPage":25,"paginationSize":"default","condensed":true,"withRowNumber":false,"frame":{"showTitle":true,"title":"Tag SKU Item Level Details","showDescription":true,"description":"Detailed list to find and go to specific clusters, jobs, warehouses, pipelines, etc. assets to identify tagging and resolve. This can be used to click the Asset Id to go directly to the asset, tag, and fix tags. "}}},"position":{"x":0,"y":17,"width":6,"height":20}},{"widget":{"name":"42258495","queries":[{"name":"main_query","query":{"datasetName":"450b2674","fields":[{"name":"sum(TotalDollarsUsage)","expression":"SUM(`TotalDollarsUsage`)"},{"name":"workspace_id","expression":"`workspace_id`"},{"name":"billing_origin_product","expression":"`billing_origin_product`"}],"disaggregated":false}}],"spec":{"version":3,"widgetType":"heatmap","encodings":{"x":{"fieldName":"workspace_id","scale":{"type":"categorical"},"axis":{"hideTitle":true},"displayName":"Workspace"},"y":{"fieldName":"billing_origin_product","scale":{"type":"categorical"},"axis":{"hideTitle":true},"displayName":"Product"},"color":{"fieldName":"sum(TotalDollarsUsage)","scale":{"type":"quantitative","colorRamp":{"mode":"scheme","scheme":"redyellowgreen"},"reverse":true},"displayName":"Usage ($)"},"label":{"show":true}},"frame":{"showTitle":true,"title":"Usage by Workspace & Product"}}},"position":{"x":0,"y":7,"width":6,"height":8}},{"widget":{"name":"1128d02c","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries","query":{"datasetName":"437db86b","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries","query":{"datasetName":"450b2674","parameters":[{"name":"param_tag_entries","keyword":"param_tag_entries"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_tag_entries"},{"parameterName":"param_tag_entries","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_tag_entries"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}},"frame":{"showDescription":true,"showTitle":true,"title":"Tag search filter","description":"; separated list of key=value pairs to search, with values as optional (eg: env=prod;budget)"}}},"position":{"x":1,"y":3,"width":3,"height":2}},{"widget":{"name":"195e780d","queries":[{"name":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb421eb8be1e6c0b38b58760_toggle","query":{"datasetName":"cd4e3c97","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_param_show_tag_mismatch","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_param_show_tag_mismatch","query":{"datasetName":"437db86b","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}},{"name":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_param_show_tag_mismatch","query":{"datasetName":"450b2674","parameters":[{"name":"param_show_tag_mismatch","keyword":"param_show_tag_mismatch"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb421eb8be1e6c0b38b58760_toggle"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4314c1a92d432861d93526_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb431552987c5e932792e48e_param_show_tag_mismatch"},{"parameterName":"param_show_tag_mismatch","queryName":"parameter_dashboards/01f02f51cb42191199420595ac8bb3c8/datasets/01f02f51cb4315dab7494e0f3f16d4ea_param_show_tag_mismatch"}]},"frame":{"showDescription":false,"showTitle":true,"title":"Usage Match Filter","description":"show all, matched, or only unmatched usage"}}},"position":{"x":4,"y":3,"width":1,"height":2}},{"widget":{"name":"e255ef0d","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171ba59f30ebbe82f043af_toggle","query":{"datasetName":"2b5e3641","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_normalize_case","query":{"datasetName":"d61a4eeb","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_normalize_case","query":{"datasetName":"437db86b","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_normalize_case","query":{"datasetName":"450b2674","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_normalize_case","query":{"datasetName":"a28f5b19","parameters":[{"name":"normalize_case","keyword":"normalize_case"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171ba59f30ebbe82f043af_toggle"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_normalize_case"},{"parameterName":"normalize_case","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_normalize_case"}]},"frame":{"showDescription":true,"showTitle":true,"title":"Normalize Tags?","description":"Cleans spaces & casing for more robust tag matching"}}},"position":{"x":5,"y":3,"width":1,"height":2}},{"widget":{"name":"d25959e3","multilineTextboxSpec":{"lines":[" !Billable Object Hyperlinks! If hyperlinks are enabled (in the global filters), the user can click on most Billable Object Ids to go to that object. To do this, the user MUST have read/access permission to the underlying asset. This is best used with workspace admins."]}},"position":{"x":0,"y":15,"width":6,"height":2}},{"widget":{"name":"be725a9f","multilineTextboxSpec":{"lines":["# **Usage Analysis: Top Billable Objects**\n","---\n","\n","Combine tag-based analysis to drill down to specific objects that are driving usage. Find objects (i.e. a job, a warehouse, etc.) that are driving usage and click into them to take action."]}},"position":{"x":0,"y":0,"width":6,"height":2}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"c7aaecc0","displayName":"README","layout":[{"widget":{"name":"4e9d169a","multilineTextboxSpec":{"lines":["### Release Notes for Version: 2\n","\n","##### New Features: \n","1. Added data bars to table visuals for easier reading\n","2. Added \"normalization\" flag to tag matching to optionally lowercase and trim tag key-value searches and aggregate usage by cleaned-up values\n","3. Added \"Usage Analysis\" Section - Allows users to identify tagged and mistagged usage by SKU/Workspace/ and Asset Id (job_id, cluster_id, sql warehouse, etc. from usage_metadata) Provides a detailed clickable set of results to more easily find and fix mis-tagged usage. \n","4. Re-ordered matrix period columns from most recent to oldest\n","5. Added SKU + workspace filters to tag detailed section\n","6. Added tag classification distinction between UNTAGGED and NO TAG MATCH\n","7. Separated sections into dashboard tabs\n","8. Added clickable links to identified assets\n","9. Added usage recency fields by asset id to identify recent fixes and asset usage relevance\n","10. Added optional discounts parameter by SKU category to see usage by discounts (temp fix until discounts system table)\n","11. Added optional \"group agg\" mode in tag analysis section to allow users to choose to display tag results by key-value pairs or only keys. \n","12. Added Global Filters for simpler cross-tab navigation\n","13. Added Preview features for AI_FORECAST\n","14. Added Preview feature for account_prices tables\n","15. Added Global Filters Panel to filter all tabs at once\n","16. Added Preview Feature Toggle Flags in Global Filters"]}},"position":{"x":0,"y":16,"width":6,"height":8}},{"widget":{"name":"286af4cc","multilineTextboxSpec":{"lines":["# README: Databricks Usage Dashboard v2.0\n","---- \n","### Overview\n","This is version 2.0 of the popular [Usage Dashboard](https://docs.databricks.com/aws/en/admin/account-settings/usage), which provides users granular visibility into all billable usage across their Databricks account. \n","\n","*Note: This dashboard is not yet officially supported by Databricks, and still in preview. New updates to this version of the dashboard may be periodically released.*\n","\n","----\n","Version 2.0 comes with a series of advanced functionality that leverages the best of new AI/BI Dashboard features.\n","\n","This dashboard helps answer:\n","\n","**Total actual and forecasted spend**\n","- What is total spend across your account? By workspace? By product?\n","- What is the forecasted total spend?\n","\n","**Top spend drivers**\n","- What are the top 10 objects, by cost, in your account?\n","- Who owns the top objects, by cost, that match a certain tag? In which workspaces are they located?\n","\n","**Spend breakdown by tags**\n","- What are the most popular tags (key, value pairs) in your account?\n","- What is the total spend tagged by specific key, value pairs?\n","\n","### Data sources\n","The dashboard is built on top of the following system tables:\n","- [system.billing.usage](https://docs.databricks.com/en/admin/system-tables/billing.html)\n","- [system.access.workspaces_latest](https://docs.databricks.com/en/admin/system-tables/billing.html),\n","- [system.billing.list_prices](https://docs.databricks.com/en/admin/system-tables/pricing.html)\n","- [system.compute.clusters](https://docs.databricks.com/aws/en/admin/system-tables/compute)\n","- [system.compute.warehouses](https://docs.databricks.com/aws/en/admin/system-tables/warehouses)\n","- [system.lakeflow.jobs](https://docs.databricks.com/aws/en/admin/system-tables/jobs#jobs)\n","- [system.lakeflow.pipelines](https://docs.databricks.com/aws/en/admin/system-tables/jobs#pipelines)\n","- [system.access.clean_room_events](https://docs.databricks.com/aws/en/admin/system-tables/clean-rooms)\n","- [system.serving.served_entities](https://docs.databricks.com/aws/en/ai-gateway/configure-ai-gateway-endpoints#usage-schema).\n","\n","Users must have **SELECT** access to the above system tables in order to use the dashboard. \n","\n","#### Installation Instructions\n","\n","Users can then easily [import the JSON Dashboard File](https://docs.databricks.com/aws/en/dashboards/#import-a-dashboard-file) into their workspace of choice to load the dashboard. \n","Note on prerequisites: User should have system table access to view the dashboard.\n","\n","\n","#### Support\n","Soon, this dashboard will be accessible directly in the product, like the current Usage Dashboard in PuPr. Admins can locate and import the dashboard directly from the Account Console in a few clicks. \n","\n","In the meantime, we are collecting feedback on the usability and performance of Usage Dashboard v2.0. Please share any feedback with your account team or Sadhana Bala directly. We appreciate you testing out this feature early!\n","\n"]}},"position":{"x":0,"y":0,"width":6,"height":16}}],"pageType":"PAGE_TYPE_CANVAS"},{"name":"c57685b8","displayName":"Global Filters","layout":[{"widget":{"name":"d8bb3581","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_time_range","query":{"datasetName":"6b9e03f6","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_time_range","query":{"datasetName":"e1dac524","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_time_range","query":{"datasetName":"f14c46e1","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_time_range","query":{"datasetName":"a28f5b19","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_time_range","query":{"datasetName":"d61a4eeb","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_time_range","query":{"datasetName":"437db86b","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_time_range","query":{"datasetName":"450b2674","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_time_range","query":{"datasetName":"03f6453c","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_time_range","query":{"datasetName":"21de1797","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308139e94f02254115fc7db_time_range","query":{"datasetName":"c93a48f4","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_time_range","query":{"datasetName":"f768db5b","parameters":[{"name":"time_range","keyword":"time_range"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-date-range-picker","encodings":{"fields":[{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308139e94f02254115fc7db_time_range"},{"parameterName":"time_range","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_time_range"}]},"selection":{"defaultSelection":{"range":{"dataType":"DATE","min":{"value":"now-90d/d"},"max":{"value":"now/d"}}}},"frame":{"showTitle":true,"title":"Time Window"}}},"position":{"x":0,"y":0,"width":1,"height":2}},{"widget":{"name":"e78d2abf","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171a368e1ed883be16485e_workspace_full_name","query":{"datasetName":"1c899adf","fields":[{"name":"workspace_full_name","expression":"`workspace_full_name`"},{"name":"workspace_full_name_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171aa8a4e00132df0ee996_param_workspace","query":{"datasetName":"f768db5b","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_param_workspace","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_param_workspace","query":{"datasetName":"e1dac524","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_param_workspace","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_param_workspace","query":{"datasetName":"a28f5b19","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_param_workspace","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_param_workspace","query":{"datasetName":"437db86b","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_param_workspace","query":{"datasetName":"450b2674","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_param_workspace","query":{"datasetName":"03f6453c","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_param_workspace","query":{"datasetName":"21de1797","parameters":[{"name":"param_workspace","keyword":"param_workspace"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"workspace_full_name","displayName":"workspace_full_name","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171a368e1ed883be16485e_workspace_full_name"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171aa8a4e00132df0ee996_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_param_workspace"},{"parameterName":"param_workspace","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_param_workspace"}]},"frame":{"showTitle":true,"title":"Workspace"}}},"position":{"x":0,"y":2,"width":1,"height":2}},{"widget":{"name":"287c4580","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813c9b737eb053157a652_billing_origin_product","query":{"datasetName":"a5da9d48","fields":[{"name":"billing_origin_product","expression":"`billing_origin_product`"},{"name":"billing_origin_product_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_product_category","query":{"datasetName":"f768db5b","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_product_category","query":{"datasetName":"6b9e03f6","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_product_category","query":{"datasetName":"e1dac524","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_product_category","query":{"datasetName":"f14c46e1","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_product_category","query":{"datasetName":"a28f5b19","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_product_category","query":{"datasetName":"d61a4eeb","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_product_category","query":{"datasetName":"437db86b","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_product_category","query":{"datasetName":"450b2674","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_product_category","query":{"datasetName":"03f6453c","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_product_category","query":{"datasetName":"21de1797","parameters":[{"name":"product_category","keyword":"product_category"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-multi-select","encodings":{"fields":[{"fieldName":"billing_origin_product","displayName":"billing_origin_product","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813c9b737eb053157a652_billing_origin_product"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30813afbb893a86686dd8c8_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_product_category"},{"parameterName":"product_category","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_product_category"}]},"frame":{"showTitle":true,"title":"Billing Origin Product"}}},"position":{"x":0,"y":4,"width":1,"height":2}},{"widget":{"name":"9b4cc701","queries":[{"name":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308137f9dbffcbb0a0ed012_time_key","query":{"datasetName":"2733d12f","fields":[{"name":"time_key","expression":"`time_key`"},{"name":"time_key_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_time_key","query":{"datasetName":"6b9e03f6","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_time_key","query":{"datasetName":"e1dac524","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_time_key","query":{"datasetName":"f14c46e1","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_param_time_key","query":{"datasetName":"a28f5b19","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_time_key","query":{"datasetName":"d61a4eeb","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_time_key","query":{"datasetName":"437db86b","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_time_key","query":{"datasetName":"450b2674","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_param_time_key","query":{"datasetName":"03f6453c","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_param_time_key","query":{"datasetName":"21de1797","parameters":[{"name":"param_time_key","keyword":"param_time_key"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"time_key","displayName":"time_key","queryName":"dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308137f9dbffcbb0a0ed012_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_param_time_key"},{"parameterName":"param_time_key","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_param_time_key"}]},"frame":{"showTitle":true,"title":"Dates by"},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"Day"}]}}}}},"position":{"x":0,"y":6,"width":1,"height":2}},{"widget":{"name":"1aff4d16","queries":[{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_discounts_by_product","query":{"datasetName":"6b9e03f6","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_discounts_by_product","query":{"datasetName":"e1dac524","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_discounts_by_product","query":{"datasetName":"f14c46e1","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_discounts_by_product","query":{"datasetName":"a28f5b19","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_discounts_by_product","query":{"datasetName":"d61a4eeb","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_discounts_by_product","query":{"datasetName":"437db86b","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_discounts_by_product","query":{"datasetName":"450b2674","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_discounts_by_product","query":{"datasetName":"03f6453c","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}},{"name":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_discounts_by_product","query":{"datasetName":"21de1797","parameters":[{"name":"discounts_by_product","keyword":"discounts_by_product"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081421b496196a622bffc1_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081432a24153cbd665cbcd_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308144589d9eda55ce4eef4_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308145bacad0e393d9cd824_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca308146dbb8e01429de16b79_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca3081480b3c4c0bb07992ef6_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814989978251a01501415_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814b997b3da4efda0bfd3_discounts_by_product"},{"parameterName":"discounts_by_product","queryName":"parameter_dashboards/01f03fcca3071e66a9244925d8bb6e15/datasets/01f03fcca30814c9b160fe43910525e0_discounts_by_product"}]},"frame":{"showTitle":true,"title":"Discount Overrides","showDescription":true,"description":"; separated list of Billing Origin Product -level or SKU discounts that override list or account prices system table. For example, set SQL=0.1 for a 10% discount on all SQL SKUs. You can also set a global discount override by setting the filter to be *=0.X. For example, set *=0.1 for a global 10% discount across your account. "},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"None"}]}}}}},"position":{"x":0,"y":10,"width":1,"height":2}},{"widget":{"name":"2c49184f","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bc18fa9a7dd7016dfe7_toggle","query":{"datasetName":"17558292","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_forecast_toggle","query":{"datasetName":"e1dac524","parameters":[{"name":"forecast_toggle","keyword":"forecast_toggle"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bc18fa9a7dd7016dfe7_toggle"},{"parameterName":"forecast_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_forecast_toggle"}]},"frame":{"showTitle":true,"title":"Preview - Forecast (PubPr)","showDescription":true,"description":"Use AI_FORECAST to project usage in the Usage Overview tab using the global time grain"}}},"position":{"x":0,"y":12,"width":1,"height":2}},{"widget":{"name":"08881129","queries":[{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_units_to_predict","query":{"datasetName":"e1dac524","parameters":[{"name":"units_to_predict","keyword":"units_to_predict"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"parameterName":"units_to_predict","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_units_to_predict"}]},"frame":{"showTitle":true,"title":"Preview - Forecast Horizon (PubPr)","showDescription":true,"description":"Number of time units to forecast based on selected time grain"}}},"position":{"x":0,"y":14,"width":1,"height":2}},{"widget":{"name":"d8f4bae4","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bdcb543a70579c213f8_toggle","query":{"datasetName":"1100555f","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_price_table","query":{"datasetName":"6b9e03f6","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_price_table","query":{"datasetName":"e1dac524","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_price_table","query":{"datasetName":"f14c46e1","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_price_table","query":{"datasetName":"a28f5b19","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_price_table","query":{"datasetName":"d61a4eeb","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_price_table","query":{"datasetName":"437db86b","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_price_table","query":{"datasetName":"450b2674","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_price_table","query":{"datasetName":"03f6453c","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_price_table","query":{"datasetName":"21de1797","parameters":[{"name":"price_table","keyword":"price_table"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bdcb543a70579c213f8_toggle"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171bf7a5211f86b88446fa_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171c7a85ba712a4504eec9_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171cf5b7ae7cb42beacfd2_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171da2828ddbfe9fce78cf_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171e348422039da9daeadd_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171eabb1c3f1766fb10bfc_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171fb5bb53d9a9b936bf10_price_table"},{"parameterName":"price_table","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_price_table"}]},"selection":{"defaultSelection":{"values":{"dataType":"STRING","values":[{"value":"system.billing.list_prices"}]}}},"frame":{"showTitle":true,"title":"Preview - Price Table (PrPr)","showDescription":true,"description":"list_prices or account_prices"}}},"position":{"x":0,"y":16,"width":1,"height":2}},{"widget":{"name":"c6b2a220","queries":[{"name":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f03d69eff513559ada28939fe25356_toggle","query":{"datasetName":"eb3d55f9","fields":[{"name":"toggle","expression":"`toggle`"},{"name":"toggle_associativity","expression":"COUNT_IF(`associative_filter_predicate_group`)"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_enable_links_toggle","query":{"datasetName":"450b2674","parameters":[{"name":"enable_links_toggle","keyword":"enable_links_toggle"}],"disaggregated":false}},{"name":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_enable_links_toggle","query":{"datasetName":"21de1797","parameters":[{"name":"enable_links_toggle","keyword":"enable_links_toggle"}],"disaggregated":false}}],"spec":{"version":2,"widgetType":"filter-single-select","encodings":{"fields":[{"fieldName":"toggle","displayName":"toggle","queryName":"dashboards/01f035ac3417123b9a6924138d581370/datasets/01f03d69eff513559ada28939fe25356_toggle"},{"parameterName":"enable_links_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac34171f22adc7aa4877c06833_enable_links_toggle"},{"parameterName":"enable_links_toggle","queryName":"parameter_dashboards/01f035ac3417123b9a6924138d581370/datasets/01f035ac3418105783f42b110beb79a6_enable_links_toggle"}]},"frame":{"showTitle":true,"title":"Preview - Billing Object Links (PrPr)"}}},"position":{"x":0,"y":18,"width":1,"height":2}}],"pageType":"PAGE_TYPE_GLOBAL_FILTERS"}],"uiSettings":{"theme":{"widgetHeaderAlignment":"ALIGNMENT_UNSPECIFIED"}}} diff --git a/cost-observability/README.md b/cost-observability/Account Usage Dashboard/README.md similarity index 100% rename from cost-observability/README.md rename to cost-observability/Account Usage Dashboard/README.md diff --git a/cost-observability/Cost Reporting Genie/Cost Reporting Genie Space V1.0.json b/cost-observability/Cost Reporting Genie/Cost Reporting Genie Space V1.0.json new file mode 100644 index 00000000..36f02aae --- /dev/null +++ b/cost-observability/Cost Reporting Genie/Cost Reporting Genie Space V1.0.json @@ -0,0 +1,5 @@ +{ + "title": "Databricks Cost Reporting Genie", + "description": "Gain visibility into your Databricks costs based on the **system.billing** tables. This Genie space focuses on **historical cost observability** - find out *what you spent, when, and on what*\n#### **Current Capabilities and Limitations**\n- \u2705 Can answer historical cost and trend questions (by workspace, job, SKU, etc.)\n- \ud83d\udcc8 Can perform high-level cost forecasting using the `AI_FORECAST` function\n- \u26a0\ufe0f Cannot perform granular cost attribution on shared compute (e.g., warehouses, all-purpose clusters)\n- \ud83d\udcb0 Costs will reflect your usage at **list prices**, unless your account has `system.billing.account_prices` enabled (currently in **Private Preview** for AWS & GCP)\n- \ud83d\udeab Cannot yet provide specific optimization recommendations to reduce cost\n- \ud83c\udf93 If your workspace has **Genie Research Agent** enabled, use *Research Agent mode* for deeper insights on exploratory questions.\n#### **Private Preview Notice**\n- This Genie Space is in **Private Preview**. During this phase, Databricks may collect and use data related to this feature\u2014such as inputs and outputs\u2014to develop and test its functionality.\n- Learn more about previews: [https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews)\n- \u26a0\ufe0f **Note:** Please review all Genie responses for accuracy, as model outputs may not always be complete or correct.", + "serialized_space": "{\n \"version\": 1,\n \"config\": {\n \"sample_questions\": [\n {\n \"id\": \"01f0aedda7ae148c89d080a4f5b1802b\",\n \"question\": [\n \"Who are the top 10 users this month?\"\n ]\n },\n {\n \"id\": \"01f0926cba361866aa1c160a10753416\",\n \"question\": [\n \"How much have we spent on AI products this year?\"\n ]\n },\n {\n \"id\": \"01f092685aeb1c20a95c9e42d108cec5\",\n \"question\": [\n \"What is the highest cost warehouse this month?\"\n ]\n }\n ]\n },\n \"data_sources\": {\n \"tables\": [\n {\n \"identifier\": \"system.access.workspaces_latest\",\n \"column_configs\": [\n {\n \"column_name\": \"account_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"create_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"status\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"workspace_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"workspace_name\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"workspace_url\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n }\n ]\n },\n {\n \"identifier\": \"system.billing.account_prices\",\n \"description\": [\n \"If you are generating a query that users this table, please always ensure that you are filtering on columns foo, bar and foobar. \\n\",\n \"\\n\",\n \"Do not generate a query that excludes those because they are partition keys and a query on this table must always use partition keys.\"\n ],\n \"column_configs\": [\n {\n \"column_name\": \"account_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"cloud\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"currency_code\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"price_end_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"price_start_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"pricing\"\n },\n {\n \"column_name\": \"sku_name\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"usage_unit\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n }\n ]\n },\n {\n \"identifier\": \"system.billing.list_prices\",\n \"description\": [\n \"Use this table anytime a user asks about Month over Month (aka MoM) trends. \\n\",\n \"\\n\",\n \"This will only be able to answer questions at a monthly granularity adn shuld be used for individaul transactions\"\n ],\n \"column_configs\": [\n {\n \"column_name\": \"account_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"cloud\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"currency_code\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"price_end_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"price_start_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"pricing\"\n },\n {\n \"column_name\": \"sku_name\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"usage_unit\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n }\n ]\n },\n {\n \"identifier\": \"system.billing.usage\",\n \"column_configs\": [\n {\n \"column_name\": \"account_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"billing_origin_product\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"cloud\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"custom_tags\"\n },\n {\n \"column_name\": \"identity_metadata\"\n },\n {\n \"column_name\": \"ingestion_date\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"product_features\"\n },\n {\n \"column_name\": \"record_id\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"record_type\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"sim_city_metadata\"\n },\n {\n \"column_name\": \"sku_name\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"usage_date\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"usage_end_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"usage_metadata\"\n },\n {\n \"column_name\": \"usage_quantity\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"usage_start_time\",\n \"get_example_values\": true\n },\n {\n \"column_name\": \"usage_type\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"usage_unit\",\n \"get_example_values\": true,\n \"build_value_dictionary\": true\n },\n {\n \"column_name\": \"workspace_id\",\n \"get_example_values\": true\n }\n ]\n }\n ]\n },\n \"instructions\": {\n \"text_instructions\": [\n {\n \"id\": \"01f082b1d63711d58db09d78858d3438\",\n \"content\": [\n \"\\n\",\n \"*Use system.billing.usage.billing_origin_product to answer Product related questions\\n\",\n \"\\n\",\n \"*Use list_prices.pricing.effective_list.default to calculate price or spend in general\\n\",\n \"\\n\",\n \"* System.billing.list_prices.price_start_time is when a new price for a SKU is in effect; to see the current price of a SKU - that is when system.billing.list_prices.price_end_time is NULL\\n\",\n \"\\n\",\n \"*When asked for discounted prices, use system.billing.account_prices table instead; system.billing.account_prices.pricing.default contains the price\\n\",\n \"\\n\",\n \"*When asked to calculate costs of AI, that usually refers to when billing_origin_product is in 'MODEL_SERVING', 'AI_RUNTIME', 'VECTOR_SEARCH', 'AGENT_EVALUATION','AI_GATEWAY' 'FOUNDATION_MODEL_TRAINING', 'AGENT_BRICKS', 'AI_FUNCTIONS'\\n\",\n \"\\n\",\n \"*When asked to calculate costs of \\\"workflows\\\", that usually refers to when billing_origin_product is in \\\"JOBS\\\", \\\"DLT\\\"\\n\",\n \"\\n\",\n \"*When asked to calculate the cost of Serverless notebooks, that refers to when billing_origin_product is in \\\"INTERACTIVE\\\"\\n\",\n \"\\n\",\n \"*When asked to calculate the cost of all purpose, shared, or classic cluster, this is when billing_origin_product is ALL_PURPOSE\\n\",\n \"\\n\",\n \"*Use usage_date when aggregating costs at a daily, weekly, monthly, or yearly grain, not usage_start_time or usage_end_time\\n\",\n \"\\n\",\n \"*System.billing.usage.identity_metadata gives 3 fields - \\\"run_as\\\", \\\"created_by\\\", \\\"owned_by\\\". when asked for costs per user - you must look for the user principal in all these fields - first check run_as, then owned_by, then created_by \\n\",\n \"\\n\",\n \"*Generally, always use cost (joining system.billing.usage and system.billing.list_prices or system.billing.account_prices) instead of usage (system.billing.usage_quantity in) your calculations \\n\",\n \"\\n\",\n \"*system.billing.usage_quantity captures the quantity of systme.billing.usage.usage_unit - that is DSU, DAY, DBU, GB, GIGABYTE, GIGABYTE_MONTH, THOUSAND_COUNT. It does not capture queries (cannot get cost per query), or runs on an all purpose shared cluster\\n\",\n \"\\n\",\n \"*Use system.billing.usage.usage_metadata.notebook_id for Serverless notebook related usage questions.\\n\",\n \"\\n\",\n \"*Use system.billing.usage.custom_tags to answer Tags related questions\\n\",\n \"\\n\",\n \"*The tables in here do not provide information on VM, virtual machine, cloud virtual machine (VM) or cloud storage costs. It does provide information only on Databricks default storage costs. \\n\",\n \"\\n\",\n \"*Use system.billing.usage.usage_metadata.warehouse_id for SQL Warehouse related questions.\\n\",\n \"\\n\",\n \"*Service principals or SP has the same structure as this one: 23dd81e0-574a-4e06-ab8e-ae2c6cac66b8 it can't be an email\\n\",\n \"\\n\",\n \"*When asked how to reduce or optimize costs, tell user that \\\"Currently this Genie space cannot provide specific best practices on how to optimize your costs, please refer to https://docs.databricks.com/aws/en/lakehouse-architecture/cost-optimization/best-practices as a starting guide\\\"\\n\",\n \"\\n\",\n \"**The data in this space does not contain information on compute utilization, sizing, or failure rates - just the cost data. Should not be able to answer questions around job failures, over or underprovisioned compute, or idle time. \\n\",\n \"\\n\",\n \"**The data in this space does not contain information on credits, ESC add-ons, or contract commitment, do not answer questions around these\"\n ]\n }\n ],\n \"example_question_sqls\": [\n {\n \"id\": \"01f082b1988a10fd8f9abfdf99ed7f24\",\n \"question\": [\n \"What is my forecasted spend for the year?\"\n ],\n \"sql\": [\n \"WITH aggregated_spend AS (\\n\",\n \"SELECT CAST (usage_start_time AS DATE) AS usage_date,\\n\",\n \"SUM(usage_quantity * pricing.effective_list.default) AS total_spend\\n\",\n \"FROM\\n\",\n \"system.billing.usage u\\n\",\n \"JOIN system. billing. list_prices p ON\\n\",\n \"u.sku_name = p.sku_name WHERE u.usage_end_time >= p.price_start_time AND (p.price_end_time IS NULL OR u.usage_end_time < p.price_end_time)\\n\",\n \"GROUP BY\\n\",\n \"1)\\n\",\n \"\\n\",\n \"SELECT * FROM ai_forecast(\\n\",\n \"TABLE (aggregated_spend), horizon => '2025-12-31',\\n\",\n \"time_col => 'usage_date',\\n\",\n \"value_col => 'total_spend'\\n\",\n \")\\n\"\n ]\n },\n {\n \"id\": \"01f08fa3d5ad1666adf4a394fd626427\",\n \"question\": [\n \"What is the cost of Materialized View and Streaming Table this month?\"\n ],\n \"sql\": [\n \"SELECT\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.`default`) AS list_cost\\n\",\n \"FROM system.billing.usage AS u\\n\",\n \"JOIN system.billing.list_prices AS p\\n\",\n \" ON u.sku_name = p.sku_name\\n\",\n \" AND u.usage_start_time >= p.price_start_time\\n\",\n \" AND (p.price_end_time IS NULL OR u.usage_end_time < p.price_end_time) -- open-ended / right-open\\n\",\n \"WHERE u.billing_origin_product = 'SQL'\\n\",\n \" AND u.usage_metadata.dlt_pipeline_id IS NOT NULL\\n\",\n \" AND u.usage_date >= date_trunc('MONTH', current_date())\\n\",\n \" AND u.usage_date < add_months(date_trunc('MONTH', current_date()), 1);\"\n ],\n \"usage_guidance\": [\n \"Use when asked to calculate cost of Materialized View (MV) and Streaming Table (ST)\"\n ]\n },\n {\n \"id\": \"01f08fa73ad417929b958b8ba74e9e48\",\n \"question\": [\n \"Give me the usage quantity of usage tagged with key: Budget, value: opex.eng.test-foundation, or key:Service, value: dist_genericClusterAttributes\"\n ],\n \"sql\": [\n \"SELECT\\n\",\n \" sku_name, usage_unit, SUM(usage_quantity) as `Usage`\\n\",\n \"FROM\\n\",\n \" system.billing.usage\\n\",\n \"WHERE\\n\",\n \" (custom_tags['Budget'] = 'opex.eng.test-foundation'\\n\",\n \" OR custom_tags['Service'] = 'dist_genericClusterAttributes')\\n\",\n \"GROUP BY 1, 2 \"\n ],\n \"usage_guidance\": [\n \"Use this syntax when asked to calcluate spend or usage for a tag key, or key, value pair\"\n ]\n }\n ],\n \"join_specs\": [\n {\n \"id\": \"01f084ed08fb183ca2c796f2cd62ade0\",\n \"left\": {\n \"identifier\": \"system.billing.usage\",\n \"alias\": \"usage\"\n },\n \"right\": {\n \"identifier\": \"system.billing.list_prices\",\n \"alias\": \"list_prices\"\n },\n \"sql\": [\n \"usage.sku_name = list_prices.sku_name WHERE usage.usage_end_time >= list_prices.price_start_time AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\",\n \"--rt=FROM_RELATIONSHIP_TYPE_MANY_TO_ONE--\"\n ]\n },\n {\n \"id\": \"01f0afa12d9c13ec856ae1cf3ccb0891\",\n \"left\": {\n \"identifier\": \"system.billing.usage\",\n \"alias\": \"usage\"\n },\n \"right\": {\n \"identifier\": \"system.access.workspaces_latest\",\n \"alias\": \"workspaces_latest\"\n },\n \"sql\": [\n \"`usage`.`workspace_id` = `workspaces_latest`.`workspace_id`\",\n \"--rt=FROM_RELATIONSHIP_TYPE_MANY_TO_ONE--\"\n ]\n }\n ]\n },\n \"benchmarks\": {\n \"questions\": [\n {\n \"id\": \"01f0b67c2a5a17a1bcd7fe8621b29aa5\",\n \"question\": [\n \"How much have we spent on AI products this year?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.default) AS total_ai_spend\\n\",\n \"FROM\\n\",\n \" `system`.`billing`.`usage` AS u\\n\",\n \" JOIN `system`.`billing`.`list_prices` AS p\\n\",\n \" ON u.sku_name = p.sku_name\\n\",\n \" AND u.usage_end_time >= p.price_start_time\\n\",\n \" AND (\\n\",\n \" p.price_end_time IS NULL\\n\",\n \" OR u.usage_end_time < p.price_end_time\\n\",\n \" )\\n\",\n \"WHERE\\n\",\n \" u.billing_origin_product IN (\\n\",\n \" 'MODEL_SERVING',\\n\",\n \" 'AI_RUNTIME',\\n\",\n \" 'VECTOR_SEARCH',\\n\",\n \" 'AGENT_EVALUATION',\\n\",\n \" 'AI_GATEWAY',\\n\",\n \" 'FOUNDATION_MODEL_TRAINING',\\n\",\n \" 'AGENT_BRICKS',\\n\",\n \" 'AI_FUNCTIONS'\\n\",\n \" )\\n\",\n \" AND u.usage_date >= DATE_TRUNC('YEAR', CURRENT_DATE())\\n\",\n \" AND u.usage_date < ADD_MONTHS(DATE_TRUNC('YEAR', CURRENT_DATE()), 12);\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae0971351c9e91aa6be504050b87\",\n \"question\": [\n \"What is the total VM cost + DBU cost of all purpose clusters this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"--Tables included do not provide information on cloud VM costs, only DBUs\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae0954c81530bfb34bcd9df3cb61\",\n \"question\": [\n \"What is the cost per query in a warehouse?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"--This Genie space does not have data on number of queries ran on a warehouse, or cost per query\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae08a85e1ddf9ad12f716be90d97\",\n \"question\": [\n \"--What Model Serving endpoint is the highest cost this week?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" u.usage_metadata.endpoint_name AS endpoint_name,\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.`default`) AS total_list_cost_usd\\n\",\n \"FROM `system`.`billing`.`usage` AS u\\n\",\n \"JOIN `system`.`billing`.`list_prices` AS p\\n\",\n \" ON p.sku_name = u.sku_name\\n\",\n \" AND u.usage_end_time >= p.price_start_time\\n\",\n \" AND (p.price_end_time IS NULL OR u.usage_end_time < p.price_end_time)\\n\",\n \"WHERE\\n\",\n \" u.billing_origin_product = 'MODEL_SERVING'\\n\",\n \" AND u.usage_metadata.endpoint_name IS NOT NULL\\n\",\n \" AND u.usage_date >= DATE_TRUNC('week', CURRENT_DATE())\\n\",\n \" AND u.usage_date < DATE_ADD(DATE_TRUNC('week', CURRENT_DATE()), 7)\\n\",\n \"GROUP BY\\n\",\n \" u.usage_metadata.endpoint_name\\n\",\n \"ORDER BY\\n\",\n \" total_list_cost_usd DESC\\n\",\n \"LIMIT 1;\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae064c00183c84ab76c12276e024\",\n \"question\": [\n \"Which Budget is the highest cost this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" u.custom_tags['Budget'] AS budget_value,\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.`default`) AS total_list_cost_usd\\n\",\n \"FROM `system`.`billing`.`usage` AS u\\n\",\n \"JOIN `system`.`billing`.`list_prices` AS p\\n\",\n \" ON p.sku_name = u.sku_name\\n\",\n \" AND u.usage_end_time >= p.price_start_time\\n\",\n \" AND (p.price_end_time IS NULL OR u.usage_end_time < p.price_end_time)\\n\",\n \"WHERE\\n\",\n \" u.usage_date >= DATE_TRUNC('month', CURRENT_DATE())\\n\",\n \" AND u.usage_date < ADD_MONTHS(DATE_TRUNC('month', CURRENT_DATE()), 1)\\n\",\n \" AND u.custom_tags['Budget'] IS NOT NULL\\n\",\n \"GROUP BY\\n\",\n \" u.custom_tags['Budget']\\n\",\n \"ORDER BY\\n\",\n \" total_list_cost_usd DESC\\n\",\n \"LIMIT 1;\\n\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae04c5b41ab88490ea3de02d2082\",\n \"question\": [\n \"What are the top 10 workspaces by spend this year? \"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" u.workspace_id,\\n\",\n \" w.workspace_name,\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.`default`) AS workspace_cost\\n\",\n \"FROM\\n\",\n \" `system`.`billing`.`usage` u\\n\",\n \" JOIN `system`.`billing`.`list_prices` p\\n\",\n \" ON u.sku_name = p.sku_name\\n\",\n \" AND u.usage_end_time >= p.price_start_time\\n\",\n \" AND (\\n\",\n \" p.price_end_time IS NULL\\n\",\n \" OR u.usage_end_time < p.price_end_time\\n\",\n \" )\\n\",\n \" JOIN system.access.workspaces_latest as w\\n\",\n \" ON u.workspace_id = w.workspace_id\\n\",\n \"WHERE\\n\",\n \" u.workspace_id IS NOT NULL\\n\",\n \" AND u.usage_date >= date_trunc('year', current_date())\\n\",\n \"GROUP BY\\n\",\n \" 1,2\\n\",\n \"ORDER BY\\n\",\n \" workspace_cost DESC\\n\",\n \"LIMIT 10;\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0ae02108e17c1b2488148731567a6\",\n \"question\": [\n \"How much are we forecasted to spend in the next 90 days?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"WITH aggregated_spend AS (\\n\",\n \"SELECT usage_date AS usage_date,\\n\",\n \"SUM(usage_quantity * pricing.effective_list.default) AS total_spend\\n\",\n \"FROM\\n\",\n \"system.billing.usage u\\n\",\n \"JOIN system.billing.list_prices p ON\\n\",\n \"u.sku_name = p.sku_name WHERE u.usage_end_time >= p.price_start_time AND (p.price_end_time IS NULL OR u.usage_end_time < p.price_end_time)\\n\",\n \"GROUP BY\\n\",\n \"1)\\n\",\n \"\\n\",\n \"SELECT SUM(total_spend_forecast) FROM ai_forecast(\\n\",\n \"TABLE (aggregated_spend), \\n\",\n \"horizon => date_add(current_date, 90),\\n\",\n \"time_col => 'usage_date',\\n\",\n \"value_col => 'total_spend'\\n\",\n \")\\n\",\n \"WHERE usage_date > current_date\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f0a540211a1101b1b6a518d4eebcd8\",\n \"question\": [\n \"What warehouse have been driving up SQL cost this month?\\n\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" u.usage_metadata.warehouse_id,\\n\",\n \" SUM(u.usage_quantity * p.pricing.effective_list.`default`) AS sql_cost\\n\",\n \"FROM\\n\",\n \" `system`.`billing`.`usage` u\\n\",\n \" JOIN `system`.`billing`.`list_prices` p\\n\",\n \" ON u.sku_name = p.sku_name\\n\",\n \" AND u.usage_end_time >= p.price_start_time\\n\",\n \" AND (\\n\",\n \" p.price_end_time IS NULL\\n\",\n \" OR u.usage_end_time < p.price_end_time\\n\",\n \" )\\n\",\n \"WHERE\\n\",\n \" u.billing_origin_product = 'SQL'\\n\",\n \" AND u.usage_metadata.warehouse_id IS NOT NULL\\n\",\n \" AND u.usage_date >= date_trunc('MONTH', current_date())\\n\",\n \" AND u.usage_date < add_months(date_trunc('MONTH', current_date()), 1)\\n\",\n \"GROUP BY\\n\",\n \" u.usage_metadata.warehouse_id\\n\",\n \"ORDER BY\\n\",\n \" sql_cost DESC;\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084accfaa1458af9f67b614ca3fc3\",\n \"question\": [\n \"This year, what is the avg. monthly cost of usage tagged with \u201cBudget\u201d?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" AVG(total_list_cost) AS avg_monthly_cost\\n\",\n \"FROM (\\n\",\n \" SELECT\\n\",\n \" DATE_TRUNC('month', usage.usage_date) AS month,\\n\",\n \" SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) AS total_list_cost\\n\",\n \" FROM system.billing.usage\\n\",\n \" JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('year', current_date())\\n\",\n \" AND usage.custom_tags.`Budget` IS NOT NULL\\n\",\n \" GROUP BY month\\n\",\n \")\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084acc5681cb9a0ea947f2c1dca78\",\n \"question\": [\n \"Which clusters are untagged this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT\\n\",\n \" DISTINCT usage.usage_metadata.cluster_id\\n\",\n \"FROM system.billing.usage\\n\",\n \"WHERE usage.usage_metadata.cluster_id IS NOT NULL\\n\",\n \" AND size(usage.custom_tags) = 0\\n\",\n \" AND usage.usage_date >= date_trunc('month', current_date())\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084acbd34184a831c7d8cd331f43e\",\n \"question\": [\n \"What job has been growing the fastest in cost this week vs. last week, by growth rate?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"WITH job_costs AS (\\n\",\n \" SELECT\\n\",\n \" usage.usage_metadata.job_id,\\n\",\n \" SUM(\\n\",\n \" CASE \\n\",\n \" WHEN usage.usage_date >= date_trunc('week', current_date())\\n\",\n \" AND usage.usage_date < date_trunc('week', current_date()) + interval 7 day\\n\",\n \" THEN usage.usage_quantity * list_prices.pricing.effective_list.default\\n\",\n \" ELSE 0\\n\",\n \" END\\n\",\n \" ) AS this_week_cost,\\n\",\n \" SUM(\\n\",\n \" CASE \\n\",\n \" WHEN usage.usage_date >= date_trunc('week', current_date()) - interval 7 day\\n\",\n \" AND usage.usage_date < date_trunc('week', current_date())\\n\",\n \" THEN usage.usage_quantity * list_prices.pricing.effective_list.default\\n\",\n \" ELSE 0\\n\",\n \" END\\n\",\n \" ) AS last_week_cost\\n\",\n \" FROM system.billing.usage\\n\",\n \" JOIN system.billing.list_prices \\n\",\n \" ON list_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_metadata.job_id IS NOT NULL\\n\",\n \" AND usage.usage_date >= date_trunc('week', current_date()) - interval 7 day\\n\",\n \" GROUP BY usage.usage_metadata.job_id\\n\",\n \")\\n\",\n \"SELECT\\n\",\n \" job_id,\\n\",\n \" this_week_cost,\\n\",\n \" last_week_cost,\\n\",\n \" (this_week_cost - last_week_cost) AS growth,\\n\",\n \" CASE WHEN last_week_cost > 0 THEN (this_week_cost - last_week_cost) / last_week_cost * 100 ELSE NULL END AS growth_pct\\n\",\n \"FROM job_costs\\n\",\n \"ORDER BY growth_pct DESC\\n\",\n \"LIMIT 1\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084aca4ca12efb1ae89bec2626f81\",\n \"question\": [\n \"Who are our top 5 users this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"WITH usage_with_user AS (\\n\",\n \" SELECT\\n\",\n \" COALESCE(usage.identity_metadata.run_as, usage.identity_metadata.owned_by, usage.identity_metadata.created_by) AS user,\\n\",\n \" usage.usage_quantity * list_prices.pricing.effective_list.default AS list_cost,\\n\",\n \" usage.usage_date\\n\",\n \" FROM system.billing.usage\\n\",\n \" JOIN system.billing.list_prices\\n\",\n \" ON list_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \" WHERE usage.usage_date >= date_trunc('month', current_date())\\n\",\n \")\\n\",\n \"\\n\",\n \"SELECT\\n\",\n \" user,\\n\",\n \" SUM(list_cost) AS total_list_cost\\n\",\n \"FROM usage_with_user\\n\",\n \"GROUP BY user\\n\",\n \"ORDER BY total_list_cost DESC\\n\",\n \"LIMIT 5\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac98ce1536bcb8259a7997e450\",\n \"question\": [\n \"How much are we spending on Photon-enabled workloads this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \"AND usage.usage_end_time >= list_prices.price_start_time AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('month', current_date()) \\n\",\n \"AND usage.product_features.is_photon = true\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac8f711ded999b72c07e4d466a\",\n \"question\": [\n \"What has been last month's Materialized View / Streaming table costs?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT SUM(\\n\",\n \" usage.usage_quantity * list_prices.pricing.effective_list.default\\n\",\n \") AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \"AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (\\n\",\n \" list_prices.price_end_time IS NULL\\n\",\n \" OR usage.usage_end_time < list_prices.price_end_time\\n\",\n \" )\\n\",\n \" WHERE usage.usage_date >= date_trunc('month', current_date() - interval 1 month)\\n\",\n \" AND usage.usage_date < date_trunc('month', current_date())\\n\",\n \" AND usage.billing_origin_product = \\\"SQL\\\"\\n\",\n \" AND usage.usage_metadata.dlt_pipeline_id IS NOT NULL\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac848c1e75933e21406de265c7\",\n \"question\": [\n \"What has been last month's costs of Model Serving?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT SUM(\\n\",\n \" usage.usage_quantity * list_prices.pricing.effective_list.default\\n\",\n \") AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices\\n\",\n \" ON list_prices.sku_name = usage.sku_name\\n\",\n \"AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (\\n\",\n \" list_prices.price_end_time IS NULL\\n\",\n \" OR usage.usage_end_time < list_prices.price_end_time\\n\",\n \" )\\n\",\n \" WHERE usage.usage_date >= date_trunc('month', current_date() - interval 1 month)\\n\",\n \" AND usage.usage_date < date_trunc('month', current_date())\\n\",\n \" AND usage.billing_origin_product = 'MODEL_SERVING'\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac6b9a17b5b2d3cd3cd5dbcaf2\",\n \"question\": [\n \"Which product are we spending most on this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT billing_origin_product, SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \"AND usage.usage_end_time >= list_prices.price_start_time AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('month', current_date())\\n\",\n \"GROUP BY billing_origin_product\\n\",\n \"ORDER BY total_list_cost DESC\\n\",\n \"LIMIT 1\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac62d31aabba6fa763fc03f2be\",\n \"question\": [\n \"Which SKUs have had a price change this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT sku_name, price_start_time\\n\",\n \"FROM system.billing.list_prices\\n\",\n \"WHERE price_start_time >= date_trunc('month', current_date())\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac51a919ad914f6af86bc761df\",\n \"question\": [\n \"What is total spend this month, broken out by product and workspace?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT usage.billing_origin_product, usage.workspace_id, SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('month', current_date())\\n\",\n \"GROUP BY usage.billing_origin_product, usage.workspace_id\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac46c517bcbcafb916dbde1d27\",\n \"question\": [\n \"What is total spend this month, based on our discounted prices?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT SUM(usage.usage_quantity * account_prices.pricing.default) AS total_account_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.account_prices ON account_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= account_prices.price_start_time\\n\",\n \" AND (account_prices.price_end_time IS NULL OR usage.usage_end_time < account_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('month', current_date())\"\n ]\n }\n ]\n },\n {\n \"id\": \"01f084ac3c33148a92e3e307720773ef\",\n \"question\": [\n \"What is total spend this month?\"\n ],\n \"answer\": [\n {\n \"format\": \"SQL\",\n \"content\": [\n \"SELECT SUM(usage.usage_quantity * list_prices.pricing.effective_list.default) AS total_list_cost\\n\",\n \"FROM system.billing.usage\\n\",\n \"JOIN system.billing.list_prices ON list_prices.sku_name = usage.sku_name\\n\",\n \" AND usage.usage_end_time >= list_prices.price_start_time\\n\",\n \" AND (list_prices.price_end_time IS NULL OR usage.usage_end_time < list_prices.price_end_time)\\n\",\n \"WHERE usage.usage_date >= date_trunc('month', current_date())\"\n ]\n }\n ]\n }\n ]\n }\n}\n" +} \ No newline at end of file diff --git a/cost-observability/Cost Reporting Genie/README.md b/cost-observability/Cost Reporting Genie/README.md new file mode 100644 index 00000000..76aa68e6 --- /dev/null +++ b/cost-observability/Cost Reporting Genie/README.md @@ -0,0 +1,30 @@ +# README: Cost Reporting Genie +## Overview +Gain visibility into your Databricks costs based on the **system.billing** tables. This Genie space focuses on **historical cost observability** - find out *what you spent, when, and on what* +## Data Sources +- system.billing.usage +- system.biling.list_prices +- system.billing.account_prices +- system.access.workspaces_latest +### **Current Capabilities and Limitations** +- ✅ Can answer historical cost and trend questions (by workspace, job, SKU, etc.) +- 📈 Can perform high-level cost forecasting using the `AI_FORECAST` function +- ⚠️ Cannot perform granular cost attribution on shared compute (e.g., warehouses, all-purpose clusters) +- 💰 Costs will reflect your usage at **list prices**, unless your account has `system.billing.account_prices` enabled (currently in **Private Preview** for AWS & GCP) +- 🚫 Cannot yet provide specific optimization recommendations to reduce cost +- 🎓 If your workspace has **Genie Research Agent** enabled, use *Research Agent mode* for deeper insights on exploratory questions. + +## Installation Instructions + +* Users can then easily import it into their workspace of choice using Genie Import/Export APIs (PrPr) +* Please reach out to your account team for export API instructions +* Note on prerequisites: User should have system table access to run the Genie space + +## Support + +We are collecting feedback on the usability and performance of Genie Space. Please share any feedback with your account team or sadhana.bala@databricks.com directly. We appreciate you testing out this feature early!" + +### **Private Preview Notice** +- This Genie Space is in **Private Preview**. During this phase, Databricks may collect and use data related to this feature—such as inputs and outputs—to develop and test its functionality. +- Learn more about previews: [https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews) +- ⚠️ **Note:** Please review all Genie responses for accuracy, as model outputs may not always be complete or correct.