Tagging and Cost Allocation

Tagging is quite common in large organizations, satisfying the requirement of allocating costs back to specific business units. It is also important for cost allocation optimization across workloads, while helping to measure business performance.

  1. Display Top 20 items with the highest cost grouped by Detailed Description and CostCenter tag
SELECT "bill_payer_account_id",
	"product_product_name",
	"line_item_usage_type",
	"line_item_line_item_description",
	resource_tags_user_cost_center,
	round(sum(line_item_unblended_cost), 2) as cost
FROM "costmaster"."monthly_report"
WHERE length("resource_tags_user_cost_center") > 0
GROUP BY "resource_tags_user_cost_center",
	"bill_payer_account_id",
	"product_product_name",
	"line_item_usage_type",
	"line_item_line_item_description"
ORDER BY cost desc
LIMIT 20

Cost

  1. Query returned results

Cost

  1. Display Top 20 items with the highest cost grouped by Detailed Description and ignoring CostCenter tag
SELECT "bill_payer_account_id",
	"product_product_name",
	"line_item_usage_type",
	"line_item_line_item_description",
	round(sum(line_item_unblended_cost), 2) as cost
FROM "costmaster"."monthly_report"
WHERE length("resource_tags_user_cost_center") = 0
GROUP BY "bill_payer_account_id",
	"product_product_name",
	"line_item_usage_type",
	"line_item_line_item_description"
ORDER BY cost desc
LIMIT 20

Cost

  1. Query returned results

Cost