简体   繁体   English

SSRS IF/Like/Then 表达

[英]SSRS IF/Like/Then Expression

I am working on a SSRS report and in this report I have multiple types of accounts for our users.我正在处理一份 SSRS 报告,在这份报告中,我为我们的用户提供了多种类型的帐户。 I obviously want to sum the total balance of certain accounts, but since there are multiple I am trying to specify the sum for each of these accounts.我显然想对某些帐户的总余额求和,但由于有多个帐户,我试图为每个帐户指定总和。 Like, AccountTypeA total is ### and AccountTypeB total is ###.例如,AccountTypeA 总计是###,AccountTypeB 总计是###。 I am building an expression but so far this is what I have:我正在构建一个表达式,但到目前为止这是我所拥有的:

IIF(Fields!AcctNum.Value Like "*.001"), True

I don't know what;s the "else" command when that field is true so it sums the balance I want for each type.我不知道当该字段为真时的“else”命令是什么,所以它总结了我想要的每种类型的余额。 Any help would be appreciated;任何帮助,将不胜感激; I am new working with SSRS :).我是 SSRS 的新成员 :)。 Thanks in advance.提前致谢。

To get conditional Sum values (or any other aggregate) you can use an expression like:要获得条件Sum值(或任何其他聚合),您可以使用如下表达式:

=Sum(IIf(Fields!AcctNum.Value like "*.001", Fields!Balance.Value, Nothing))

This only considers rows that satisfy your first criterion (ie certain AcctNum values) for the aggregation.这仅考虑满足聚合的第一个条件(即某些AcctNum值)的行。

Use InStr.使用 InStr。 Eg, =InStr(Fields!Description.Value, "car").例如,=InStr(Fields!Description.Value, "car")。

Evert occurance of the string Car will increment by one so (pesudo code)字符串 Car 的 Evert 出现将增加 1 so(伪代码)

if(InStr(Fields!Description.Value, "car") > 0, "True part","False Part") if(InStr(Fields!Description.Value, "car") > 0, "True part","False Part")

Hope this helps.希望这可以帮助。

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

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