Grouping on Multiple Columns

Let’s say I have these columns:

Address | Primary Agent | Secondary Agent

The address is a unique entry, one per row. Each Agent shows up for several Addresses on the sheet. There are several other detail columns, but it is not important for this question. Now I want a tab that lists all Addresses in a list or cards, but I want it grouped by each Agent. So the address will essentially have to show up twice on the tab (unless no Secondary Agent is listed). The Address (and details) will be listed once under each Agent.

Is this possible?

1 Like

Hi Jason! Yes, with the “group by” feature, you should be able to group by agent. Add the inline list and then click on Features>Group by…you should have every column in your sheet available and you can select Agent.

Yes, but you can only group on a single column that way. I want to group on two columns as if they were one.

Ah, sorry, missed that…no, you can only group by one column…you can see if using the in app sort/filter is an option for users to find what they want.

I was hoping I could do something with relations or array formulas, but I’m stumped. Without completely reworking my data I can’t figure it out, and I need to keep it this way for printout purposes.

1 Like

@Jeff_Hager or @ThinhDinh are the experts on array formulas and spreadsheet magic. Let’s see if they have an idea.

Do you have your agent columns set up as an array? (Ex. ‘Agent 1’, ‘Agent 2’)

1 Like

Just tried array. Couldn’t wrap my head around it this early.

1 Like

No luck @Robert_Petitto? I haven’t tried it yet.

The array column isn’t available as an option for grouping. Probably the same reason why it’s not available as a choice component. Values need to be on their own rows.

But if anyone can find a way, it’s probably you. You’re the king of relations.

I don’t. And I can’t. I need to have a row titles the way they are for presentation purposes.

Hi Jason, can you share your sheet with demo details?

@Robert_Petitto yeah I see that now.

@Jason_Szumlanski I think the problem here is that we would be trying to pull an extra row out of thin air by making an address row first show for the Primary Agent and then make the same row reappear again for the Secondary Agent. That’s just not how glide works. I would maybe consider a details layout with two inline lists. One grouped by Primary Agent and one grouped by Secondary Agent. If I recall, a Group By will skip any rows that have a blank value for the column being grouped. So if your Primary Agent is always filled, all rows will show in the first inline list, but for the second inline list, only the rows that have a Secondary Agent will show. The only problem is you won’t be able to alphabetically sort both lists together.

2 Likes

Okay, that might be my only option. Sounds reasonable. Not exactly what I had hoped but understandable.

1 Like

If I think of something different, I’ll let you know.