I have the following schema in BigQuery displaying population numbers and their respective countries:
country STRING
country_code STRING
year_1960 INT
year_1961 INT
...
year_2019 INT
See here: bigquery-public-data.world_bank_global_population.population_by_country
So, I already found the countries with the biggest growth in the last 50 years. However, how would I be able to find out which respective year is their year with the strongest year on year growth?
**Usually window functions such as lag in combination with MAX would save the day, but here I would have to use one that goes over columns instead of rows. **
Is this possible somehow? Maybe using an array per country or using python in BigQuery?
Thanks in advance!
I tried to define the year 1960 as an offset of a lag function but this obviously does not work.