
First add the 'flexible height gallery' then insert the 'vertical gallery'.
Here are the formulas if you want to just copy/paste:

ClearCollect(test_data,
{code: "001", start: Date(2014,09,03), end: Date(2024,01,31)},
{code: "001", start: Date(2024,02,01), end: Date(2050,09,11)},
{code: "002", start: Date(2024,02,01), end: Date(2050,09,11)},
{code: "002", start: Date(2024,02,01), end: Date(2050,09,11)},
{code: "004", start: Date(2024,02,01), end: Date(2050,09,11)}
)

Filter(GroupBy(test_data, "code", "data"), CountRows(data) >= 1)

With({table: SortByColumns(Filter(test_data, code = ThisItem.code), "start", SortOrder.Descending)},
ForAll(Sequence(CountRows(
table
)),
Patch(Last(FirstN(
table,
Value)), {RowNumber: Value})
))

Self.TemplateHeight * CountRows(Self.AllItems)

ThisItem.RowNumber = 1