简体   繁体   中英

Groups and aggregates in SSRS

I have a dataset in SSRS which is actually a view that has following data

A   | B    | C
========================
B101 | Box   | 100
B101  | Box   | 100.2
B101   | Cart   |99
B102   | Box    |110

From the dataset, I need to repot sum of column C where C>=100 group by Col A and ColB So the report looks something like this:

A   |  B   |C
===============
B101  | Box  | Sum(100+100.2)
B102   | Box    |Sum(110)

I can't figure out how to achieve or set the query on the report dataset. Is there a way to do it without creating a new dataset that does group by?

Is this what you are looking for?

SELECT A, B, SUM(C)
FROM TABLE
WHERE SUM(C) >= 100
GROUP BY A, B

If not I think you may be on about Drilldown reports that can sum in the header row. Have a look here .

You can do this by applying an appropriate filter to the table and setting up the grouping as required.

I have the following data:

在此处输入图片说明

Create a table with a group based on A and B :

在此处输入图片说明

在此处输入图片说明

Add a filter at the table level to exclude rows < 100 :

在此处输入图片说明

For my data I had to cast the the value to a Decimal type; you may not need to. This gives what I think are your required results:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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