| 粒度 | 券码一行 |
|---|---|
| 时间戳 | 发放/领取/核销/过期 |
| 度量 | 面额/门槛/核销金额 |
核销统计
核销统计
SELECT substr(redeem_ts, 1, 10) AS redeem_dt,
count(1) AS redeem_cnt, sum(face_amt) AS redeem_amt
FROM fact_coupon
WHERE redeem_ts IS NOT NULL
GROUP BY 1;券与订单多对多时(一单多券/一券多单),核销分摊要单独建模。
券的生命周期(发放-领取-核销-过期)用状态时间戳表达:一行一券码,用「当月核销额」等口径时注意区分发券批次与核销时间。
| 粒度 | 券码一行 |
|---|---|
| 时间戳 | 发放/领取/核销/过期 |
| 度量 | 面额/门槛/核销金额 |
SELECT substr(redeem_ts, 1, 10) AS redeem_dt,
count(1) AS redeem_cnt, sum(face_amt) AS redeem_amt
FROM fact_coupon
WHERE redeem_ts IS NOT NULL
GROUP BY 1;