I'm working on a nested gallery using SharePoint data. The data is sorted by Regional Office and it is working fine. The issue is that I need to sort by a second column (State). Both the Regional Office and the State are choice columns.
Sorting / Grouping by Regional Office works fine:
SortByColumns(
GroupBy(
AddColumns(
Filter(
'Catalog',
Year = "2021"
),
"RO",
'Regional Office'.Value
),
"RO",
"GrouppedROs"
),
"RO",
Ascending
)
When I try to add a second sorting parameter (State), it fails:
SortByColumns(
GroupBy(
AddColumns(
Filter(
'Catalog',
Year = "2021"
),
"RO",
'Regional Office'.Value,
"TheState",
'State'.Value
),
"RO",
"GrouppedROs"
),
"RO",
Ascending,
"TheState",
Ascending
)
I get an error that says in part that "TheState" column doesn't exist:

I have the feeling that all the issue is that I'm creating or placing TheState column in the wrong place. Any idea what am I doing wrong?
Thanks in advance.