Skip to content

calculations.matches_7_league_stats_window

Adds league-level rolling averages (1-year window, excluding the current match) on top of the team stats. Inherits all upstream columns.

flowchart LR
m6[/matches_6_team_stats_window/] --> me[/calculations.matches_7_league_stats_window/]
me --> m8[/matches_8_team_strength/]
me --> mart[/mart.matches/]
click m6 "/calculations/matches_6_team_stats_window/" "Open"
click m8 "/calculations/matches_8_team_strength/" "Open"
click mart "/mart/matches/" "Open"
ColumnDescriptionFormula
* (matches_6_team_stats_window)All upstream columns.passthrough
stats_goals_league_avg_homeLeague-wide mean home goals (prior year, excl. current).round(coalesce(avg(score_home) over (partition by league_id order by toUnixTimestamp(event_date) RANGE BETWEEN 31536000 PRECEDING AND 1 PRECEDING), 0), 2)
stats_goals_league_avg_awayLeague-wide mean away goals (prior year, excl. current).round(coalesce(avg(score_away) over (partition by league_id order by toUnixTimestamp(event_date) RANGE BETWEEN 31536000 PRECEDING AND 1 PRECEDING), 0), 2)