Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @svetla87
You can follow below
- Create the metric view for MAX credit_limit per account/date (account_credit_limit).
- Aggregate with SUM at query time using SQL CTE or subquery pattern
-- Get MAX credit per account per day from metric view
WITH account_maxes AS (
SELECT
month_id,
time_key,
account_id,
MEASURE(account_credit_limit) as max_credit_limit
FROM card_metric_view
GROUP BY month_id, time_key, account_id
)
-- SUM across accounts to get monthly total
SELECT
month_id,
SUM(max_credit_limit) as total_credit_limit
FROM account_maxes
GROUP BY month_id
ORDER BY month_id;