简体   繁体   English

SSRS:如何根据条件求和

[英]SSRS: How to SUM row data based on condition

I have table of the structure:- 我有表格的结构:-

Row1:- not inside Details group. 第1行:-不在“详细信息”组中。

Row 2:- Dynamically populating row. 第2行:动态填充行。 with sequence as:- 顺序为:-

A X X

A1 1 A1 1

A2 2 A2 2

B Y Y

B1 30 B1 30

B2 40 B2 40

I need to calculate value of Y(which is Value of B1+B2) and X(which is Value of A1+A2) 我需要计算Y(B1 + B2的值)和X(A1 + A2的值)的值

Also in Row 1 I need to display X+Y. 同样在第1行中,我需要显示X + Y。

Please note:- I am not sure about the number of rows which can be there in either A or B. So Y can be B1+B2+B3.... so on. 请注意:-我不确定A或B中可以存在的行数。因此Y可以是B1 + B2 + B3 ....等。

Also A and B are being populated by the same dataset. 同样,A和B也由同一数据集填充。

It's a bit unclear as to how your data is set up so I can't give a good answer but for SUMming based on a condition you'd want to do something like: 关于如何设置数据尚不清楚,因此我无法给出一个很好的答案,但是对于基于条件的求和,您想要执行以下操作:

=SUM(IIF(FIELDS!A.Value = "X", FIELDS!UNKNOWN?.Value, 0))

This would SUM all of the UNKNOWN field when field A = x . field A = x时,这将求和所有UNKNOWN字段。

If this isn't what you were looking for, try adding your field names and relate them to your values. 如果这不是您想要的内容,请尝试添加字段名称并将其与您的值相关联。

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

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