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


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

