Sql SSRS表达式-减和

Sql SSRS表达式-减和,sql,reporting-services,ssrs-2008,Sql,Reporting Services,Ssrs 2008,我需要一些关于SSRS表达式的帮助,该表达式求和然后减去和。我有一个数据集,其中包含帐户和相应的货币/金额值。我试图写一个表达式,将一组账户在指定范围内的货币/金额值相加,然后从另一个范围内的货币/金额总和中减去。例如: (Sum(amt) where acct between 40000 and 49999) - (Sum(amt) where (acct between 50000 and 59999) or (acct between 66000 and 69999)) - (Sum(

我需要一些关于SSRS表达式的帮助,该表达式求和然后减去和。我有一个数据集,其中包含帐户和相应的货币/金额值。我试图写一个表达式,将一组账户在指定范围内的货币/金额值相加,然后从另一个范围内的货币/金额总和中减去。例如:

(Sum(amt) where acct between 40000 and 49999) - 
(Sum(amt) where (acct between 50000 and 59999) or (acct between 66000 and 69999)) - 
(Sum(amt) where acct between 76000 and 79825) - 
(Sum(amt) where acct between 89000 and 90399) 
我真的需要一些帮助,将上面的SQL逻辑转换成一个表达式,用于SSRS中的文本框。任何建议都会非常有用!谢谢

试试这个:-

=Sum(
     iif(Fields!acct.Value) >= 1 and
         Fields!acct.Value) < 4 ,
     Fields!amt.Value,0
        )
    )
-
 Sum(
     iif(
         (Fields!acct.Value>=5 and Fields!acct.Value<10)
          or (Fields!acct.Value>=12 and Fields!acct.Value< 15),
          Fields!amt.Value,0 
         )
    )
-
Sum(
     iif(
         Fields!acct.Value) >= 76000 and
         Fields!acct.Value) < 79825 ,
         Fields!amt.Value,0
         )
   )
-
Sum(
   iif(
       Fields!acct.Value) >= 89000 and
       Fields!acct.Value) < 90399 ,
   Fields!amt.Value,0
       )
    )
=Sum(
iif(字段!科目值)>=1和
字段!会计值)<4,
领域!金额值,0
)
)
-
总数(
iif(
(字段!会计价值>=5,字段!会计价值=12,字段!会计价值<15),
字段!金额值,0
)
)
-
总数(
iif(
字段!会计值)>=76000和
字段!会计值)<79825,
领域!金额值,0
)
)
-
总数(
iif(
字段!会计值)>=89000和
字段!会计值)<90399,
领域!金额值,0
)
)

谢谢你,Praveen。这最终奏效了,尽管我不得不在我的终端做一些转换和聚合。此外,我在布尔值中使用了“NOTHING”而不是“0”。