简体   繁体   English

报表生成器-总表达式

[英]Report Builder - Total Expressions

I have a report that displays the following data: 我有一个报告,显示以下数据:

  • Quantity 数量
  • Line Item Total/Extended Price (this is based off of a formula of rate * quantity) 订单项总/扩展价格(基于费率*数量的公式)
  • Product Type (ie Type A, B, C, D, & Other) 产品类型(即A,B,C,D和其他类型)

At the bottom of the report, I would like to add a small three column table that takes the total quantity and price by the product type. 在报告的底部,我想添加一个小的三列表,该表按产品类型获取总数量和价格。

The table will only ever have 5 rows - row 1 = Type A, etc. Columns will be "Qty" and "Total" which should represent the sum of each based on the type. 该表将仅包含5行-第1行= Type A,依此类推。列将为“ Qty”和“ Total”,应表示基于类型的每列之和。

I am struggling getting a RunningValue formula to work with a IIF statement that would filter based on type. 我正在努力让RunningValue公式与将根据类型进行过滤的IIF语句一起使用。

Here is what I have tried in cell A1 of the table (to display qty total for type a only): 这是我在表格的单元格A1中尝试过的内容(仅显示类型a的总数):

=IIf(Fields!type.Value="A",RunningValue(Fields!quantity.Value, Sum, Nothing)

To achieve this it would be best to use a Matrix, as follows 为此,最好使用矩阵,如下所示

  1. Create a matrix and set the row grouping to be your Type Field. 创建一个矩阵并将行分组设置为您的类型字段。

  2. Right click the column header and select Insert Column – Inside Group Left to give you two columns to display the Quantity and Total values. 右键单击列标题,然后选择“插入列-内部组左”,为您提供两列以显示“数量”和“总计”值。

  3. In the header you can right click the area and selected Insert -> Rectangle, then added two text boxes to give the column headings (in blue) 在标题中,您可以右键单击该区域,然后选择“插入”->“矩形”,然后添加两个文本框以给出列标题(蓝色)

  4. In the left Dataset set the expression to be 在左侧的数据集中,将表达式设置为

     =sum(CInt(Fields!Qty.Value)) 

    To sum all the values for this Type together (Note this assumes the are integers, you can use CDbl for doubles for example) 将该类型的所有值加起来(注意,假设这是整数,例如,您可以将CDbl用于双精度)

  5. Do the same for the Totals text box as well (note I have set the expression to return a currency as well – Right Cick -> Palaceholder Properties -> Number -> Currency) 对“总计”文本框也执行相同的操作(请注意,我也将表达式设置为也返回一种货币–右击-> Palaceholder Properties-> Number-> Currency)

  6. This matrix looks as follows in design mode 在设计模式下,此矩阵如下所示

    在此处输入图片说明

    And like this when rendered (note the source data I am using to generate this is also shown) 渲染时是这样的(请注意,还显示了我用来生成该源数据的源数据)

    在此处输入图片说明

Is this the sort of output you required? 这是您所需的输出吗? Let me know if I can help further. 让我知道是否可以进一步提供帮助。

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

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