Forum Discussion
Creating a dynamic filtered table variable
- 8 months ago
Hi CeeJayC,
Thank you for your patience . The issue is that SWITCH and IF in DAX only return scalar values, not tables, which caused the parameter is not the correct type error in your earlier attempts.To resolve this, you need to adjust the logic to switch between complete calculations, such as the results from SUMX, rather than switching between tables.
SWITCH works in this context because it produces scalar values from each SUMX calculation. Each branch uses its own FILTER, so the slicer selection still manages the filtering logic. This approach avoids both the type mismatch error and the “multiple columns cannot be converted to scalar” issue.
Please give it a try and let us know how it goes.
Regards,
Community Support Team.
Hi CeeJayC,
Thank you for your patience . The issue is that SWITCH and IF in DAX only return scalar values, not tables, which caused the parameter is not the correct type error in your earlier attempts.
To resolve this, you need to adjust the logic to switch between complete calculations, such as the results from SUMX, rather than switching between tables.
SWITCH works in this context because it produces scalar values from each SUMX calculation. Each branch uses its own FILTER, so the slicer selection still manages the filtering logic. This approach avoids both the type mismatch error and the “multiple columns cannot be converted to scalar” issue.
Please give it a try and let us know how it goes.
Regards,
Community Support Team.
Hi CeeJayC,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.
Regards,
Community Support Team.