Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reporting services 计算总计时忽略SSRS列组_Reporting Services - Fatal编程技术网

Reporting services 计算总计时忽略SSRS列组

Reporting services 计算总计时忽略SSRS列组,reporting-services,Reporting Services,我有一个SSR矩阵,如下所示: +--------------------+-------------------------+ | | Date | + +----------+--------------+ | | Quantity | All Quantity | +----------+---------+----------+-----

我有一个SSR矩阵,如下所示:

+--------------------+-------------------------+
|                    | Date                    |
+                    +----------+--------------+
|                    | Quantity | All Quantity |
+----------+---------+----------+--------------+
| Employee | Total   |          |              |
+          +---------+----------+--------------+
|          | Product |          |              |
+----------+---------+----------+--------------+
Employee1   Product1    200 2012-01
Employee1   Product1    500 2012-02
Employee1   Product1    900 2012-03
Employee1   Product2    300 2012-01
Employee1   Product2    500 2012-02
Employee1   Product2    40  2012-03
Employee2   Product1    450 2012-01
Employee2   Product1    50  2012-02
Employee2   Product1    30  2012-03
Employee2   Product2    0   2012-01
Employee2   Product2    50  2012-02
Employee2   Product2    120 2012-03
在此表中,
员工
是一个
行组
产品
是一个子
行组
<代码>日期是一个
列组
。在
Quantity
字段中,我有从数据库中输入的数字。在
所有数量
列中,我需要在该
日期组中获得
数量
的总金额。但使用我的表达式,它使用来自所有日期组的数据计算所有数量

我的意思是,对于日期“2012-07-13”,所有数量应为1000,对于日期“2012-06-12”,应为500。但事实并非如此,两个日期都显示为1500。我应该如何解决这个问题

我的表达是:

Sum(字段!数量.Value,“员工”)
数据集如下所示:

+--------------------+-------------------------+
|                    | Date                    |
+                    +----------+--------------+
|                    | Quantity | All Quantity |
+----------+---------+----------+--------------+
| Employee | Total   |          |              |
+          +---------+----------+--------------+
|          | Product |          |              |
+----------+---------+----------+--------------+
Employee1   Product1    200 2012-01
Employee1   Product1    500 2012-02
Employee1   Product1    900 2012-03
Employee1   Product2    300 2012-01
Employee1   Product2    500 2012-02
Employee1   Product2    40  2012-03
Employee2   Product1    450 2012-01
Employee2   Product1    50  2012-02
Employee2   Product1    30  2012-03
Employee2   Product2    0   2012-01
Employee2   Product2    50  2012-02
Employee2   Product2    120 2012-03
这是我所拥有的,我所得到的,我所需要的一个例子

//IF I USE Sum(Fields!Quantity.Value)
                    Date1                       Date2
                    Quantity    All Quantity    Quantity    All Quantity
Employee1   Total   590         -               190         -
                    100         100             50          50
                    200         100             50          50
                    150         150             40          40
                    50          50              30          30
                    90          50              20          20

//IF I USE Sum(Fields!Quantity.Value, "Employee")
                    Date1                       Date2
                    Quantity    All Quantity    Quantity    All Quantity
Employee1   Total   590         -               190         -
                    100         780             50          780
                    200         780             50          780
                    150         780             40          780
                    50          780             30          780
                    90          780             20          780

//I NEED TO GET
                    Date1                       Date2
                    Quantity    All Quantity    Quantity    All Quantity
Employee1   Total   590         -               190         -
                    100         590             50          190
                    200         590             50          190
                    150         590             40          190
                    50          590             30          190
                    90          590             20          190

如果您可以在SQL中执行操作,那么它将始终比在RDL中更快,但是,至少有一种方法可以在报表中执行。 使用上面的第二个选项, 总和(字段!数量.值,“员工”):

在我在下面指示的单元格*,给它一个名称。它将是文本框11或其他什么,称之为EmployeeTotal。 在我用插入符号^标记的单元格中,输入以下表达式

=ReportItems!EmployeeTotal.Value
然后你会得到你想要的(见附图)

下次,如果您提供的数据集示例与您提供的要显示的数据集示例相匹配,我们将更容易为您提供帮助

e、 g.在我运行来测试这个的模型中,我使用这个查询来创建我认为是您的真实数据集:

![SELECT        'Employee1' AS Employee, 'Product1' AS Product, 100 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product2' AS Product, 200 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product3' AS Product, 150 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product4' AS Product, 50 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product5' AS Product, 90 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product1' AS Product, 50 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product2' AS Product, 50 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product3' AS Product, 40 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product4' AS Product, 30 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product5' AS Product, 20 AS Quantity, '2012-02' AS Date

如果您可以在SQL中执行操作,那么它将始终比在RDL中更快,但是,至少有一种方法可以在报表中执行。 使用上面的第二个选项, 总和(字段!数量.值,“员工”):

在我在下面指示的单元格*,给它一个名称。它将是文本框11或其他什么,称之为EmployeeTotal。 在我用插入符号^标记的单元格中,输入以下表达式

=ReportItems!EmployeeTotal.Value
然后你会得到你想要的(见附图)

下次,如果您提供的数据集示例与您提供的要显示的数据集示例相匹配,我们将更容易为您提供帮助

e、 g.在我运行来测试这个的模型中,我使用这个查询来创建我认为是您的真实数据集:

![SELECT        'Employee1' AS Employee, 'Product1' AS Product, 100 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product2' AS Product, 200 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product3' AS Product, 150 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product4' AS Product, 50 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product5' AS Product, 90 AS Quantity, '2012-01' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product1' AS Product, 50 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product2' AS Product, 50 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product3' AS Product, 40 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product4' AS Product, 30 AS Quantity, '2012-02' AS Date
UNION ALL
SELECT        'Employee1' AS Employee, 'Product5' AS Product, 20 AS Quantity, '2012-02' AS Date

有没有可能在问题的末尾添加一个示例数据集?我刚刚添加了它。这是一个非常简单的数据集,不清楚“数量”和“所有数量”的区别是什么。尽管如此,我认为如果您的分组是正确的,那么简单的
总和(Fields!Quantity.Value)
(不要指定任何分组)应该可以做到这一点。“Quantity”是员工组中一个产品的数量。“所有数量”是一名员工所有产品数量的总和(与员工总数类似)。简单
Sum(Fields!Quantity.Value)
在“总计”行中正确计算总计,但我在每一行中都需要它,这就是问题所在。我刚刚添加了一个示例,说明了我所拥有的、得到的和需要的。有没有可能在问题的末尾添加一个示例数据集?我刚刚添加了它。这是一个非常简单的数据集,不清楚“数量”和“所有数量”的区别是什么。尽管如此,我认为如果您的分组是正确的,那么简单的
总和(Fields!Quantity.Value)
(不要指定任何分组)应该可以做到这一点。“Quantity”是员工组中一个产品的数量。“所有数量”是一名员工所有产品数量的总和(与员工总数类似)。简单的
Sum(Fields!Quantity.Value)
在“总计”行中正确计算总计,但我在每一行中都需要它,这就是问题所在。我刚刚添加了一个示例,说明了我所拥有的、得到的和需要的。