1

私は次のようなssrsにマトリックスを持っています:

+--------------------+-------------------------+
|                    | Date                    |
+                    +----------+--------------+
|                    | Quantity | All Quantity |
+----------+---------+----------+--------------+
| Employee | Total   |          |              |
+          +---------+----------+--------------+
|          | Product |          |              |
+----------+---------+----------+--------------+

この表Employeeでは、Row groupProductは子row groupです。Dateですcolumn group。フィールドにはQuantity、データベースからの数字があります。列には、このAll Quantityの合計金額が必要です。しかし、私の式を使用すると、すべてのデータを使用して計算されます。 QuantityDate groupAll QuantityDate groups

つまり、日付「2012-07-13」の場合、すべての数量は 1000 であり、日付「2012-06-12」の場合は 500 である必要があります。しかし、その代わりに、両方の日付で 1500 と表示されます。これをどのように解決すればよいですか?

私の表現はここにあります:

Sum(Fields!Quantity.Value, "Employee")

データセットは次のようになります。

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
4

1 に答える 1

1

SQLで処理できる場合は、RDLよりも常に高速になりますが、レポートで実行できる方法は少なくとも1つあります。上記の2番目のオプションを使用すると、Sum(Fields!Quantity.Value、 "Employee"):

以下に示すセル*に名前を付けます。textbox11か何かになり、EmployeeTotalと呼びます。カレット^でマークしたセルに、この式を入力します

=ReportItems!EmployeeTotal.Value

その後、必要なものを取得します(添付の画像を参照)。1

                    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

次回は、表示したいものと一致するデータセットの例を提供すると、より簡単にサポートできます。

たとえば、これをテストするために実行したモックアップでは、このクエリを使用して、実際のデータセットと思われるものを作成しました。

![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
于 2012-10-11T04:21:05.863 に答える