Forum Discussion
SELECTCOLUMNS throwing "not a valid table expression" when inside IF statement
Hello all,
I am trying to create a table but I'm running into an issue where the SELECTCOLUMNS does not return a "valid table expression" when it comes from an IF statement. If it is outside the IF statement, it works fine. I've already checked the conditional and it works fine. There are no relationships in the model.
I've attached images of my DAX formula. In this example, my test_table variable works fine when I return it, but if I try to return name_combo (where the only possible outcome is test_table), I get thrown the error message. Same thing happens if I try to append Table2_Name to test_table and name_combo using ADDCOLUMNS (test_table works whereas name_combo does not).
Any help would be appreciated, thank you. test_table definitionTable1When I return name_comboWhen I return test_tableTable2
This looks a bit overcomplex but the error is returned because IF can only return a scalar value (so not a table)