Skip to content

Commit e1b13aa

Browse files
committed
add to_timestamp in mart
1 parent c97d146 commit e1b13aa

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.evidence/customization/custom-formatting.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"formatTag": "kwh3",
1111
"formatCode": "#,##0.000\" kWh\"",
1212
"valueType": "number"
13+
},
14+
{
15+
"formatTag": "hm",
16+
"formatCode": "H:MM",
17+
"valueType": "date"
1318
}
1419
]
1520
}

models/marts/marts.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ models:
3030
description: Peak moment of the month
3131
tests:
3232
- not_null
33+
- name: month_peak_timestamp_end
34+
description: End of the peak moment of the month
35+
tests:
36+
- not_null
3337
- name: month_peak_date
3438
description: Peak moment of the month as date
3539
tests:

models/marts/mrt_capacity_tariff.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
with usage_data as (
22
select
33
from_timestamp,
4+
to_timestamp,
45
usage
56
from {{ ref('int_electricity') }}
67
),
@@ -10,6 +11,7 @@ components as (
1011
month(u.from_timestamp) as month,
1112
year(u.from_timestamp) as year,
1213
u.from_timestamp,
14+
u.to_timestamp,
1315
u.usage * 4 as quarter_power,
1416
dd.*
1517
from usage_data u
@@ -34,6 +36,7 @@ with_avg as (
3436
d.month_name_short as month_name_short,
3537
d.month_start_date as month_start_date,
3638
d.from_timestamp as month_peak_timestamp,
39+
d.to_timestamp as month_peak_timestamp_end,
3740
d.from_timestamp::date as month_peak_date,
3841
p.month_peak as month_peak_value,
3942
avg(p.month_peak) over (rows between 11 preceding and current row) as month_peak_12month_avg,

0 commit comments

Comments
 (0)