How to display rows/columns based on a table's values ("matrix" display?)
How to display rows/columns based on a table's values ("matrix" display?)
a3n
Posts: 1Questions: 1Answers: 0
I'm not sure what the correct terminology is for this use case, so I didn't find docs/examples yet (in Drupal this kind of grouping is done via a module called Views Matrix). Here's what I mean -- given a table like this:
Country | Year | Value |
---|---|---|
USA | 2016 | 1 |
USA | 2017 | 1 |
USA | 2018 | 2 |
Canada | 2016 | 2 |
Canada | 2017 | 2 |
Canada | 2018 | 1 |
Belgium | 2016 | 3 |
Belgium | 2017 | 3 |
... I'd want to have rows based on the column "Country", and create columns for all the values in the column "Year", so we'd get:
Country | 2016 | 2017 | 2018 |
---|---|---|---|
USA | 1 | 1 | 2 |
Canada | 2 | 2 | 1 |
Belgium | 3 | 3 |
I didn't create a working example as I'm not sure where to start. Is it possible? Thanks!
This discussion has been closed.