这让我有点发疯。看起来应该很容易,但 SSRS 让我很难过。
我想为我们的客户创建一个报告,显示每月销售总额,并在每第三个月末显示季度总额,例如
客户 1 月 2 月 3 月1 月 4 月 6月 2 月2月 8 月...
我是 SSRS 的新手,我已经创建了包含季度总数和最右端的报告,但我可以每三个月了解一下如何做。
在网上搜索并没有真正帮助我找到解决方案。如果您能给我一些见解,我将不胜感激。
更新 我的数据存在于一张表中。这是查询:
SELECT customer
, customercode
, city
, state
, salesperson
, invoiceYear
, invoiceMonth
, CAST(SUM(netSalesValue + discValue) / 1000 AS decimal(10, 1)) AS grossSales
, CASE WHEN invoiceMonth BETWEEN 1 AND 3
THEN 'Q1'
WHEN invoiceMonth BETWEEN 4 AND 6
THEN 'Q2'
WHEN invoiceMonth BETWEEN 7 AND 9
THEN 'Q3'
WHEN invoiceMonth BETWEEN 10 AND 12
THEN 'Q4'
END AS QuarterPeriod
, Sync
FROM orderstable
WHERE (Sync = 1)
AND (invoiceYear = @InvoiceYear)
GROUP BY invoiceYear
, invoiceMonth
, salesperson
, customer
, customercode
, city
, state
, Sync
ORDER BY salesperson
, customer
, invoiceMonth
我的查询结果如下:
Customer Name | 0000305 | Orange | CA | SalesPerson Name | 2015 | 1 | 8.4 | Q1 | True