Columns from a single Thing in a Repeating Group

Hi Team,

I’m trying to create a repeating group from multiple columns from a single record (thing). That part’s easy, but I want to be able to group the data in the repeating group the same as the columns, but also not show empty coulmns.

For example, let’s say I have the following data:

Category 1 Category 2 Category 3 Category 4 Category 5
Item 1,
Item 2
Item 3 Item 4,
Item 5

My repeating group would then look something like this (grouped by Category, essentially):

Category 1
Item 1, Item 2


Category 3
Item 3


Category 4
Item 4, Item 5

I’m sure it can be done without too much wrangling, but it’s beyond me at the moment…