Question

I have stored procedure which returns around 100 rows. One column is Category.

In SSRS, I've created DataSet related to that stored procedure. On Report body I have Tablix, which I relate to DataSet.

Now, I have additional parameter, called FilterColumn, which consist all different categories from dataset, plus one row called "All products".

How to filter tablix based on that parameter to show me whether products from specific categories or all products?

Was it helpful?

Solution 2

I have created some solution and worked for me:

enter image description here

In Expression field, I put first expression:

1.  Iif(Parameters!FilterColumn.Value = "All", 1, Fields!Category.Value)

In Value field, I put second expression:

2.  Iif(Parameters!FilterColumn.Value = "All", 1, Parameters!FilterColumn.Value)

So, when I choose "All" value in parameter, then first expression will result 1, and second expression will result 1, and i have 1 = 1 which is true for all rows, and I got all rows in table.

When I choose specific category from parameter, then in first expression result will be Fields!Category.Value and in second expression will be Parameters!FilterColumn.Value. Simple, I got Fields!Category.Value = Parameters!FilterColumn.Value, or just give me rows where category is that choosen in parameter.

OTHER TIPS

You need to set up a filter similar to the following:

enter image description here

Where the expression is:

=IIf(Parameters!FilterColumn.Value = Fields!Category.Value
        or Parameters!FilterColumn.Value = "All products"
    , "Include"
    , "Exclude")

This matches the row Category based on the parameter value, or, if the value = All products, will include all rows.

As mentioned in the comments and the other answer, this is possible in the SP too, but since it seems to be specifically to demonstrate the functionality this should do the trick at the report level.

Pass the Additional Parameter to your store procedure, so you send data that is already sorted to your report. This will avoid multiple Tablix created depending on your parameter selection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top