Find the sum of 5 rows in ssrs report

Posted by hareeshkumarkr-16190 under Sql Server on 1/27/2014 | Points: 10 | Views : 930 | Status : [Member] | Replies : 3
Hi,

I have a ssrs report in that report totaly 30 rows and 4 colums are there, in 4th column i have to find the sum of only five , five rows.


The file has been attached




Responses

Posted by: Sabtu89 on: 1/27/2014 [Member] Starter | Points: 25

Up
0
Down
I was delighted when the kitchen arrived and was very impressed with the service Stilhaus Kitchens gave me. They've certainly got a contented customer in me and everyone in my house loves our new elegant kitchen.

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 1/28/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down

;with CTE (3 columns, Num) as

(
select 3 columns, ROW_NUMBER() over(order by AnyDateColumn desc) as num from yourTable
)
select 3 columns, SUM(CASE WHEN Num <= 5 THEN Amount ELSE 0 END) OVER() as Top5Amount
from CTE


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Snaveen on: 2/13/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

My suggestion is don't do any critical operations on reports side. Reports are mainly used to display the content purpose only. If you did some critical calculations in Reports that's not good. Better to perform that action on your Stored Procedure itself.

If you want to calculate sum then use below sample with conidtions whatever required to achieve this.

select sum(colname) from tablenmae


hareeshkumarkr-16190, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response