简体   繁体   中英

SSRS Filter by parameter and Value condition

I am trying to add an parameter that will allow the user to filter by unit Cost. Ie If for parameter Unit cost, User select "All Costs", it will not perform any filter and will show all items. However, if for the parameter Unit cost, the user selects "Greater than 0" it would only display items that have unit cost > 0.

I have declared the parameter with two available values "U" and A". However, what would the Parameter condition look like? I tried adding the condition which was = IIF(Parameter!Text.Value = "U", UnitCost, NOTHING) > 0 . This doesn't seem to be working though. Can anyone provide suggestions as to how this would be done.

You can use an expression to determine if a row should be filtered or not based on the parameter selected value.

Add a new Filter condition in your tablix and use these settings and expressions:

在此处输入图片说明

In Expression textbox use:

=Switch(
Parameters!Text.Value = "All", "Include",
Parameters!Text.Value = "U" AND Fields!UnitCost.Value > 0, "Include",
Parameters!Text.Value = "A" AND Fields!UnitCost.Value > 10, "Include",
true, "Exclude"
)

In the Value textbox use:

="Include"

Note your parameter should have an available value as conditions to filter you need.

在此处输入图片说明

In this case I use A parameter value to filter the UnitCost values greater than 10 and U value to filter UnitCost values greater than 0. Customize to meet your requeriment.

Let me know if this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM