简体   繁体   English

SSRS-如何对LookUpSet表达式的值求和

[英]SSRS - How to Sum values on a LookUpSet expression

Hi I have a column that uses a lookupset expression =Join(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0"), "ExecutionCount")) .I'm getting an incorrect parameter when I sum that expression to =Join(Sum(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0")), "ExecutionCount")) . 嗨,我有一列使用lookupset表达式=Join(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0"), "ExecutionCount")) 。将表达式加和=Join(Sum(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0")), "ExecutionCount")) The column to sum is cntSelfService. 要累加的列是cntSelfService。 Please advise. 请指教。

You have a few different issues with your expression. 您的表情有一些不同的问题。

  1. When you use the FORMAT function, the result is a string, not a number. 当您使用FORMAT函数时,结果是字符串,而不是数字。
  2. JOIN is used to concatenate strings from a table into a single string which wouldn't help your issue. JOIN用于将表中的字符串连接为单个字符串,这对您的问题无济于事。
  3. SUM will not work with a LookupSet SUM不适用于LookupSet

Unfortunately, there's not a built-in way to sum values from a LookupSet. 不幸的是,没有一种内置的方法可以对LookupSet中的值求和。

Luckily, users have had this issue for a while and someone created a function in Visual BASIC SumLookUp that will add the values from a lookupset. 幸运的是,用户已经有此问题一段时间了,有人在Visual BASIC SumLookUp中创建了一个函数,该函数将添加lookupset中的值。 You add the code in the Report Properties --> Code tab. 您将代码添加到“ 报告属性->代码”选项卡中。

Your expression would be: 您的表达将是:

=CODE.SumLookup(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Fields!cntSelfService.Value, "ExecutionCount"))

See the code in: Need help in calculation using two Datasets using Expression SSRS 请参见以下代码: 使用表达式SSRS使用两个数据集进行计算时需要帮助

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

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