Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi team,
I need to write a DAX query I will call externally from paginated report that based on the parameter should return calcaulted in DAX Table 1 or Table 2.
VAR Table1= ..
VAR Table 2=...
EVALUATE
if (<condition>, Table1, Table2)
doesn't work for Table as an argument. I wonder if there are other options I can leverage.
Thank you in advance.
Hi @EduardD ,
First of all, in DAX Query, IF statement and Swith statement are not able to return the table directly, they return a scalar value.
Then I create a table as you mentioned.
I think you can use this DAX code to extract different tables directly.
EVALUATE
VAR _Sales2023 =
SELECTCOLUMNS(
FILTER(
Sales,
Sales[Year] = 2023
),
"Date", Sales[Date],
"Amount", Sales[Amount]
)
VAR _Sales2024 =
SELECTCOLUMNS(
FILTER(
Sales,
Sales[Year] = 2024
),
"Date", Sales[Date],
"Amount", Sales[Amount]
)
RETURN
_Sales2023
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous . Thank you for suggestion. If I got it right you recommend to union table1 and 2 into one table and have extra column that differentiate between parameters. Then use filter to return table 1 or 2 rows based on parameter selection. It might work, the only problem I envision is that this table would have a key column no longer unique, that will break 1 to many relationships with other tables.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.