简体   繁体   English

SSRS-使用不同日期的数据集(表)

[英]SSRS - Dataset using different dates (Table)

I'm creating a report with all of the sales made from each product category. 我正在创建一个报告,其中包含每个产品类别的所有销售额。 I added a table that contains on the column side: Months and for Rows I have the Product Category (ie Chairs, Tables, etc.). 我添加了一个包含在列侧的表格:月,对于行,我具有产品类别(即椅子,桌子等)。

So it should be looking something like this: 所以它应该看起来像这样:

Product | January | February | March | April
---------------------------------------------
Chairs  | value   | value    | value | value

Tables  | value   | value    | value | value

So the thing is that I need to calculate the total amount of chairs sold each month. 因此,我需要计算每月售出的椅子总数。

I created the query: 我创建了查询:

SELECT SUM(Quantity)
FROM Sales
WHERE PurchaseDate BETWEEN '2015-01-01' AND '2015-01-31'

That query is inside a Dataset, but I'm looking for a way to use this same Dataset but pass it or change the PurchaseDate range in order to calculate the rest of the sales per month. 该查询位于数据集内部,但我正在寻找一种使用此相同数据集的方法,但可以将其传递或更改PurchaseDate范围,以计算每月的其余销售额。

Add a Matrix with the following fields and groups settings: 添加具有以下字段和组设置的Matrix

在此处输入图片说明

In Row Groups add Category field and in Column group add a Parent Group , use the following expression: Row Groups添加类别字段,在列组中添加Parent Group ,使用以下表达式:

=MONTHNAME(MONTH(Fields!PurchaseDate.Value))

Use the above expression in the column at the right side of Category column. 在“ Category列右侧的列中使用以上表达式。

It will preview the following matrix: 它将预览以下矩阵:

在此处输入图片说明

Note my example only include dates in January and February, in your case it should show every all months returned by your dataset. 请注意,我的示例仅包含1月和2月的日期,在您的情况下,它应显示数据集返回的所有月份。

Let me know if this helps. 让我知道是否有帮助。

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

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