-
Sum in Report
How can I list every items in the report but not calculate them in the group aggregation function?
For example:
col1 col2 col3 col4 col5
2 5 1 3
1 4 7 9 N
6 3 1 6
Sum like:
8 8 2 9
The row with "N" will not be calculated in Sum function.
Thank you for the help!
-
how can you get sum without using SUM()?
-
I'm not sure what your data could look like, but how about something like this?
SELECT
SUM(CASE WHEN col5 <> 'N' THEN col1 ELSE 0 END) AS col1,
SUM(CASE WHEN col5 <> 'N' THEN col2 ELSE 0 END) AS col2,
SUM(CASE WHEN col5 <> 'N' THEN col3 ELSE 0 END) AS col3,
SUM(CASE WHEN col5 <> 'N' THEN col4 ELSE 0 END) AS col4,
SUM(CASE WHEN col5 <> 'N' THEN col5 ELSE 0 END) AS col5
FROM YourTable
-
I am talking about Reporting Services here.
How can I exclude certain row(s) from the aggregation group?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|