SELECT from different tables based on previous column

Hi I am having a bit of trouble with a switch formula.

I have  a previous Enum column called [CHANNEL].
The choices are:   Key Accounts, SME, Others.

The next column is a text field with suggested values based on the selection from [CHANNEL].

What I want is, if [CHANNEL] is "Key Accounts", then return values from table "KA" as suggested values.
But if [CHANEL] is "SME", then return values from table "SME" as suggested values.
else, then return values from table "PCRegGen" as suggested values.

I used a SWITCH() function with the following expression.

 

SWITCH([CHANNEL],
"Key Accounts", SELECT(KA[MID], [DBA Name]=[_THISROW].[DBA Name], TRUE),
"SME", SELECT(SME[MID], [DBA Name]=[_THISROW].[DBA Name], TRUE),
SELECT(PCRegGen[MID], [DBA Name]=[_THISROW].[DBA Name], TRUE)
)

 

However, AppSheet is throwing me an error.

JPAlpano_0-1673949812023.png

I also tried to use Filter instead but same result.

 

SWITCH([CHANNEL],
"Key Accounts", FILTER("KA", [DBA Name]=[_THISROW].[DBA Name]),
"SME", FILTER("SME", [DBA Name]=[_THISROW].[DBA Name]),
SELECT(PCRegGen[MID], [DBA Name]=[_THISROW].[DBA Name], TRUE)
)

 

Is there any workaround I can do?

0 2 125
2 REPLIES 2
Top Labels in this Space