| Actor | Fragment | Worker | State |
|---|---|---|---|
| 55193 | 3158 | 3 | running |
| 55194 | 3158 | 3 | running |
CREATE MATERIALIZED VIEW adib_rm.pnl_snapshot_mv AS
SELECT
account_group_id,
dim_balance_date,
position_type,
currency_code,
unrealized_gain_loss,
total_average_cost,
unrealized_gain_loss_system_currency,
total_average_cost_system_currency
FROM (
SELECT
*,
ROW_NUMBER() OVER (
PARTITION BY account_group_id, position_type, currency_code
ORDER BY dim_balance_date DESC
) AS rn
FROM insights.pnl_summary_mv
)
WHERE
rn = 1