SSRS filters using "IN"

  • I have a table that I need to sort by multiple values and am not having much luck. Is is possible to use the "In" expression in a table?

    Field: =Fields!XYZ.value

    Operator: IN

    Value: ?????

    When I only use 1 value (123456) the filter works. However when I add multiple values, no results are displayed.

    I have tried the following values

    -(123456,456789)

    -123456,56789

    -"123456","56789"

    -'123456','56789'

    PLEASE HELP

  • Hey

    To add filter try this (workaroud only 🙂 )

    Field(Expression): =(Fields!XYZ.value=123456) or (Fields!XYZ.value=56789)

    Operator: =

    Value: =true

    for IN keyword found another workaroud here

    http://dbaspot.com/forums/ms-sqlserver/384322-ssrs-chart-filter-use-operator.html

  • This was frustrating me today, so I decided to figure it out. It turns out that SSRS likes to evaluate the "Value" field as a string if you don't put an = sign in front. I've found a few ways to get this working:

    1. Put a formula in the expression list that returns a boolean, use the "=" sign for the Operator and use "=True" for the value (e.g.

    Expression: =(Fields!Language.Value = "English"

    AND NOT

    (

    Fields!contact_name.Value = 12345

    OR Fields!contact_name.Value = 4456

    ))

    Operator: =

    Value: =True

    )

    2. Use the "In" Operator and then put a comma-separated list in the value (unfortunately there isn't a not in)

    (e.g.

    Expression: Fields!contact_name.Value

    Operator: In

    Value: 12345,4456

    Either of these solutions works. I prefer the former as it is more flexible, but it's also a little more complex. I know this is an older post, but I hope this helps someone.

  • Used your workaround within an iif-statement in my group-filter in the chart, that finally did the trick.

    So instead of using the Chart Properties filter I used the Category Groups Properties filter,

    then said "=iif((Fields!Something.Value = 6) or (Fields!Something.Value = 8), 1, 0)"

    then compared integer with = operater to value 1.

    And finally only groups 6 and 8 are showing their values without error.

    Cost me way 2 much time, hopefully usefull to someone else.

  • SSRS IN operator works on Arrays, convert your string list to array using Split

    Far away is close at hand in the images of elsewhere.
    Anon.

  • When using IN be sure your parameter is not set to the first value:

    =Parameters!NameofParam.Value(0). This is the default. Remove the "(0)" and you'll get the array automatically.

    NameofField.Value

    IN

    Parameters!NameofParam.Value

  • Many thanks...!

  • this "SSRS IN operator works on Arrays, convert your string list to array using Split" worked..

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply