Skip to content

Commit 5692e2c

Browse files
committed
more date columns in mart
1 parent 7e6ff20 commit 5692e2c

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

models/marts/marts.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ models:
3838
description: Peak moment of the month as date
3939
tests:
4040
- not_null
41+
- name: month_peak_day_of_week_name
42+
description: Name of the day of the week of the peak moment of the month
43+
tests:
44+
- not_null
45+
- name: month_peak_day_of_month
46+
description: Day of the month of the peak moment of the month
47+
tests:
48+
- not_null
49+
- name: month_peak_day_type
50+
description: Type of the day of the peak moment of the month
51+
tests:
52+
- not_null
53+
- accepted_values:
54+
values:
55+
- weekday
56+
- weekend
57+
- name: month_peak_is_holiday
58+
description: Whether the peak moment of the month is a holiday
59+
tests:
60+
- not_null
4161
- name: month_peak_value
4262
description: Peak value of the month
4363
tests:

models/marts/mrt_capacity_tariff.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ with_avg as (
3838
d.from_timestamp as month_peak_timestamp,
3939
d.to_timestamp as month_peak_timestamp_end,
4040
d.from_timestamp::date as month_peak_date,
41+
d.day_of_week_name as month_peak_day_of_week_name,
42+
d.day_of_month as month_peak_day_of_month,
43+
d.day_type as month_peak_day_type,
44+
d.is_holiday as month_peak_is_holiday,
4145
p.month_peak as month_peak_value,
4246
avg(p.month_peak) over (rows between 11 preceding and current row) as month_peak_12month_avg,
4347
from components d

pages/capacity-tariff.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ select
77
month_name,
88
month_name_short,
99
month_peak_12month_avg as month_peak_12month_avg_kwh3,
10-
month_start_date
10+
month_start_date,
11+
month_peak_timestamp as month_peak_timestamp_hm,
12+
month_peak_timestamp_end as month_peak_timestamp_end_hm
1113
from mrt_capacity_tariff
1214
```
1315

@@ -23,14 +25,16 @@ select
2325
*
2426
from ${mrt_capacity_tariff}
2527
order by month_start_date desc
26-
limit 4
28+
limit 6
2729
```
2830

29-
The current (<Value data={mrt_capacity_tariff_last_months} column=month_name_short/>) monthly peak is **<Value data={mrt_capacity_tariff_last_months} column=month_peak_value_kwh3/>**. The change over last month (<Value data={mrt_capacity_tariff_last_months} column=month_name_short row=1/>) is **<Value data={mrt_capacity_tariff_last_months} column=pct_change_pct1/>** as we then had <Value data={mrt_capacity_tariff_last_months} column=month_peak_value_kwh3 row=1/>.
31+
The current (<Value data={mrt_capacity_tariff_last_months} column=month_name_short/>) monthly peak is **<Value data={mrt_capacity_tariff_last_months} column=month_peak_value_kwh3/>**.
32+
33+
The change over last month (<Value data={mrt_capacity_tariff_last_months} column=month_name_short row=1/>) is **<Value data={mrt_capacity_tariff_last_months} column=pct_change_pct1/>** as we then had <Value data={mrt_capacity_tariff_last_months} column=month_peak_value_kwh3 row=1/>.
3034

3135
The average monthly peak for the last 12 months is **<Value data={mrt_capacity_tariff_last_months} column=month_peak_12month_avg_kwh3/>**.
3236

33-
Here are the monthly peaks for the last 4 months:
37+
Here are the monthly peaks for the last 6 months:
3438

3539
{#each mrt_capacity_tariff_last_months as month_row}
3640

0 commit comments

Comments
 (0)