Using a Case statement field to populate a parameter

702 Views Asked by At

Forgive me if I butcher this but I'm fairly new to this: I used a case statement to give additional values to an field, for example

CASE Field A > 60 THEN '>60' END AS 'NEW_FIELD'

After the WHERE Clause I would like to use this new field as a parameter so AND NEW_FIELD AS (@PARAMETER), but Report Builder says it cannot use a column name as a parameter, although I have seen this used in different parameters and works fine. Any advice?

2

There are 2 best solutions below

2
Thiyagu On
 CASE WHEN Field A > 60 THEN '>60' END =@PARAMETER

You can try this in your WHERE Clause

0
White_Homme On

Fixed. I was trying to pass a new CASE field as a parameter. Which was generating an error stating invalid column name. To resolve, I used this CASE field in my report builder table as a field, but in order to pass as a parameter, I essentially used CASE in my WHERE clause like Thiyagu stated above, but had to modify the syntax to - END IN (@Parameter). Thanks!