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! It's time to submit your entry. Live now!
Hi everyone,
I want to use a list as a filter based on a condition, however the following code indicates that final_list is not a valid table. The code will work if I use list1 or list2 directly, but not if I wrap them in the IF statement.
Do I need to convert final_list to a table for this to work?
VAR list1 = {"123", "456"}
VAR list2 = {"789"}
VAR final_list = IF(condition = true(), list1, list2)
RETURN FILTER (table, column IN final_list) <- final_list is not a valid tableThank you,
Kevin
Solved! Go to Solution.
I tried recreating your problem by making a test table:
After this I tried with dax to create a new calculated table that filters the original table based on a condition. I don't know which condition your using so I made a true/false condition in the dax code that could easily be switched out.
I made the table as follows:
and when condition is FALSE:
Hope this is helpfull
I tried recreating your problem by making a test table:
After this I tried with dax to create a new calculated table that filters the original table based on a condition. I don't know which condition your using so I made a true/false condition in the dax code that could easily be switched out.
I made the table as follows:
and when condition is FALSE:
Hope this is helpfull
Hi @TRADER083 ,
Try below code.
VAR FinalList =
IF(
condition,
ROW("Value","123") & ROW("Value","456"),
ROW("Value","789")
)
RETURN
FILTER(table, table[column] IN FinalList
[Value])
If my response as resolved your issue please mark it as solution and give kudos.
Why your DAX doesn't work
In DAX:
So yes — you must convert the list into a table before using it inside IN.
Correct DAX
Convert the list into a table using DATATABLE or SELECTCOLUMNS.
----------DAX----------
VAR list1 = SELECTCOLUMNS({ "123", "456" }, "Value", [Value])
VAR list2 = SELECTCOLUMNS({ "789" }, "Value", [Value])
VAR final_list = IF(condition = TRUE(), list1, list2)
RETURN
FILTER(
table,
table[column] IN final_list
)
----------DAX----------
Now final_list is a valid single-column table, and IN works perfectly.
==================================================
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Jaywant Thorat | MCT | Data Analytics Coach
Linkedin: https://www.linkedin.com/in/jaywantthorat/
Join #MissionPowerBIBharat = https://shorturl.at/5ViW9
#MissionPowerBIBharat
LIVE with Jaywant Thorat from 15 Dec 2025
8 Days | 8 Sessions | 1 hr daily | 100% Free
Hi @Jaywant-Thorat, unfortunately, it has the same error. Looks like the IF statement is still converting the result to variant.
| User | Count |
|---|---|
| 53 | |
| 40 | |
| 35 | |
| 24 | |
| 22 |
| User | Count |
|---|---|
| 136 | |
| 111 | |
| 58 | |
| 43 | |
| 38 |