我有一个查询,它从数据库中收集项目并生成许多行:
SELECT
ITEMID,
SUM(dbo.CUSTINVOICETRANS.QTY) AS 'Quanity',
SUM(LINEAMOUNTMST) AS 'Sales',
COUNT(DISTINCT dbo.CUSTINVOICEJOUR.SALESID) AS 'Total Orders'
INTO
#tempItemRevenue
FROM
dbo.CUSTINVOICEJOUR INNER JOIN
dbo.CUSTINVOICETRANS ON dbo.CUSTINVOICEJOUR.INVOICEID = dbo.CUSTINVOICETRANS.INVOICEID
WHERE
dbo.CUSTINVOICETRANS.DIMENSION2_ IN (@division)
AND
CONVERT(DATETIME, dbo.CUSTINVOICETRANS.INVOICEDATE, 101) BETWEEN @start AND @end
GROUP BY
ITEMID
SELECT
ITEMGROUPID AS 'Process',
[DESCRIPTION] AS 'Division',
ISNULL(PRICE / CASE WHEN PRICEUNIT = 0 THEN NULL ELSE PRICEUNIT END, 0) AS 'Unit Price',
SUM(LOADQTY) AS 'Load Size',
SUM(LOADQTY * ISNULL(PRICE / CASE WHEN PRICEUNIT = 0 THEN NULL ELSE PRICEUNIT END, 0)) AS 'Load Value',
SUM(Sales) as 'Sales',
SUM(Quanity) AS 'Quantity'
FROM
dbo.INVENTTABLE INNER JOIN
dbo.INVENTTABLEMODULE ON dbo.INVENTTABLE.ITEMID = dbo.INVENTTABLEMODULE.ITEMID
INNER JOIN #tempItemRevenue ON dbo.INVENTTABLE.ITEMID = #tempItemRevenue.ITEMID
INNER JOIN dbo.DIMENSIONS ON NUM = dbo.INVENTTABLE.DIMENSION2_
--INNER JOIN dbo.CUSTTABLE cu ON ACCOUNTNUM = CUSTACCOUNT
WHERE
MODULETYPE = 2
AND
ITEMGROUPID IN (@group)
AND
dbo.INVENTTABLE.DIMENSION2_ IN (@division)
and LOADQTY * ISNULL(PRICE / CASE WHEN PRICEUNIT = 0 THEN NULL ELSE PRICEUNIT END, 0) > 0
Group BY
ITEMGROUPID,[DESCRIPTION],PRICE,PRICEUNIT
DROP TABLE #tempItemRevenue
这会产生如下结果:
Process Division Unit Price Load Size Load Value Sales Quantity
Anodize Green Bay 0.132916 1050 139.5618 26 200
Anodize Green Bay 0.15375 2000 307.5 447.45 2983
Anodize Green Bay 0.156 5000 780 848 5300
Anodize Green Bay 0.1751 17040 2983.704 278.64 1548
Anodize Green Bay 0.187138516 13520 2530.112741 3147.35 16565
我将它放入一个SSRS表中它总结了所有内容,但它总结了每一行...我需要所有具有相同过程的所有内容总共得到总和。但我无法获得report builder 3.0给我一个总结所有行的选项。 从本质上讲,我希望每个流程和部门有一条线(有很多种组合)。不是每个订单项。 我究竟做错了什么?我似乎无法获得总数。
答案 0 :(得分:1)
所以,我可以在Tablix字段的底部添加一个总计行,如下所示:
单击行标题(以便突出显示整行)。 Tablix中的第一个文本框显示“处理”的位置,您将看到一个括号(表示行分组。右键单击它,然后转到添加行,然后在组外添加行。这应该给你一个在所有组之外的单行,您可以在其中总结以上所有内容。