Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 definition
Table1
When I return name_combo
When I return test_table
Table2
Solved! Go to Solution.
This looks a bit overcomplex but the error is returned because IF can only return a scalar value (so not a table)
Thank you both @HotChilli @lbendlin for the help and helping me understand Power BI a little better
This looks a bit overcomplex but the error is returned because IF can only return a scalar value (so not a table)
Exactly. Same with SWITCH.
You need to calculate both tables speculatively, and then do the IF thing later.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |