Appending data in a table

So my data structure in elastic search is very complicated, but basically there can be up to 5 different ages in each document. The are each called age, age_2, age_3, age_4, age_5. I’ve created queries and transformations to arrive at this table. You’ll notice that the same age could be in any of the age columns. I want to simplify this to 1 table with 2 columns, one for age and one for the total count. So for example the 50+ age should be the total of the age (count) when 50+ is in age, age_2 (count) when 50+ is in age_2, etc.