A flat in years of salary

Joins two ARMID series, chains a price index onto a base price, and draws a KPI, a line and a table.

How many years of net salary does a 60 m² flat in Yerevan cost? Paste the workbook below into a new problem’s Workbook tab, run it and commit it.

title: How many years of salary is a 60 m² flat in Yerevan?
params:
  area_m2: { default: 60, min: 30, max: 150, step: 5, label: "Flat size, m²" }
  net_share: { default: 0.75, min: 0.5, max: 1, step: 0.01, label: "Net pay as a share of gross" }
  base_year: { default: 2019, min: 2019, max: 2024, step: 1, label: "Year of the base price" }
  base_price: { default: 450000, min: 100000, max: 2000000, step: 10000, label: "AMD per m² in the base year" }
nodes:
  wages:
    series: { find: "nominal wages marzes yerevan", as: wage, max_series: 20 }
    filter: contains(series, 'Yerevan - Yerevan')
    resample: { to: year, how: mean, by: [series] }
    select: [year, wage]
  price_change:
    series: { find: "index for apartments yerevan", as: index }
    filter: not contains(series, 'Outside')
    resample: { to: year, how: mean, by: [series] }
    formula:
      change_pct: if(index > 50, index - 100, index)
    select: [year, change_pct]
  price:
    from: price_change
    formula:
      price_m2: chain(base_price, change_pct, base_year)
  affordability:
    join: [wages, price]
    on: [year]
    formula:
      flat_price: price_m2 * area_m2
      years_of_salary: flat_price / (wage * 12 * net_share)
  headline:
    chart: { from: affordability, type: kpi, x: year, y: years_of_salary, unit: years, title: "Years of net salary for the flat" }
  trend:
    chart: { from: affordability, type: line, x: year, y: years_of_salary, unit: years }
  table:
    chart: { from: affordability, type: table }

How it works:

  1. wages reads ArmStat’s wage series by marz, keeps Yerevan’s, averages it per year, and keeps two columns — as: wage names the value column.
  2. price_change reads the central bank’s apartment price index for Yerevan, a year-on-year index, and turns it into a % change.
  3. price compounds the change onto the base price with chain: ARMID has no price-per-m² series, so the base price is a parameter.
  4. affordability joins wages and prices by year and computes the answer.
  5. Three display nodes draw it.

Change a parameter on the dashboard and every node recomputes.