如何在 SSRS 报表矩阵中使用条件表达式显示来自不同数据集的数据

huangapple go评论50阅读模式
英文:

How do I display data from different dataset in SSRS report matrix using expression with conditions

问题

=sum(iif(Fields!week.Value <> 5, Fields!Received.Value, "DATASET2", 0)) / 5

我得到了这个错误。
[rsFieldReference] 文本框 'Textbox9' 的值表达式引用了字段 'Received'。报表项表达式只能引用当前数据集范围内的字段,或者如果在聚合函数内部,则引用指定的数据集范围。字段名称中的字母必须使用正确的大小写。

你可以提供的任何帮助将不胜感激。

英文:

I have a matrix report that references a specific dataset (DATASET1). I need to be able to add a row of data from a separate dataset (DATASET2) but I also need to add conditions to the expression.

This is what I'm currently using and it does populate data.

=Sum(Fields!Received.Value, "DATASET2") / 5

However, I need to add logic to the expression to only look for rows where the week value is not equal to 5.

This is what I've tried:

=sum(iif(Fields!week.Value <> 5, Fields!Received.Value,"DATASET2" ,0)) / 5

I'm getting this error.
[rsFieldReference] The Value expression for the text box 'Textbox9' refers to the field 'Received'. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case.

Any help you can provide would be appreciated.

答案1

得分: 1

=SUM(IIF(Fields!week.Value <> 5, Fields!Received.Value, 0),"DATASET2") / 5

英文:

I think you just need to move the dataset reference to outside the IIF statement to make it work right.

=SUM(IIF(Fields!week.Value &lt;&gt; 5, Fields!Received.Value, 0),&quot;DATASET2&quot;) / 5

huangapple
  • 本文由 发表于 2023年4月7日 02:05:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952490.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定