Dropdown from multiple tables by conditional SWITCH()

Hello… I need help to get column data from different table using Can I select columns from different table using SWITCH()?

I have two dropdown - a) Brand and b) Category.
Brand is an enum dropdown with base type ‘text’. Category is an enumlist dropdown with base type ‘text’. The column data i want is also type ‘text’.

Each brand has multiple product categories. However, all the categories for each brand are in different tables having same column structure. Depending on the brand selected, the category dropdown should change… I am trying the below expression under Valid_if constraint:

SWITCH( TEXT([Principal]),
“Brand A”,SELECT(Table A[Category], true),
“Brand B”,SELECT(Table B[Category],true),
SELECT(Table A[Category],true)
)

But i keep getting this error:
“SWITCH function is used incorrectly:Inputs to SWITCH() must be an initial expression, one or more value-result pairs, and a default result. Input 5 is not a value of a consistent type.”

Kindly help.
Thank you.

Solved Solved
3 13 2,061
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

Try:

SWITCH(
  [Principal],
  "Brand A",
    (LIST() + Table A[Category]),
  "Brand B",
    (LIST() + Table B[Category]),
  (LIST() + Table A[Category])
)

View solution in original post

13 REPLIES 13
Top Labels in this Space