简体   繁体   English

SSRS按参数和值条件过滤

[英]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. 但是,如果用户为参数“单位成本”选择“大于0”,它将仅显示单位成本> 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. 我已经声明了带有两个可用值“ U”和“ A”的参数。但是,参数条件是什么样的?我尝试添加条件,即= IIF(Parameter!Text.Value = "U", UnitCost, NOTHING) > 0 ,但是似乎没有用,任何人都可以提供有关如何完成操作的建议。

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: 在您的tablix中添加新的Filter条件,并使用以下设置和表达式:

在此处输入图片说明

In Expression textbox use: 在“ Expression文本框中使用:

=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: Value文本框中,使用:

="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. 在这种情况下,我使用A参数值来过滤大于10的UnitCost值,并使用U值过滤大于0的UnitCost值。进行自定义以满足您的需求。

Let me know if this helps. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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