Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Column totals in reverce order

Author  Topic 

learntsql

524 Posts

Posted - 2009-06-29 : 08:34:21
Hi All
In my Report i have to show as following

Name count total
A 10 35
B 5 25
C 20 20

But how can display total column based on Count column which starts counting total from last row.
Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-29 : 08:41:33
As far as I can see, the total column is displayed.
What is your objective? Do you want to SORT things?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

learntsql

524 Posts

Posted - 2009-06-29 : 08:49:20
sorry if am not clear,
my query returns Name and count columns
and i need to build Total column in report itself;
and that is also from end of the last row of count andding it to previous row.

for eg;
C contains value of itself becoz its last row
B contains sum(B+C) i.e 5+20=25
A contains sum(A+B+C) i.e 10+5+20=35

what is the best way
please suggest me.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-29 : 09:03:37
You can do the running total in SQL Server and then ORDER BY in your report any way you want.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-29 : 09:05:13
Can Reports calculate running total in reverse order ?

Here is the query way.

select *, Total = (select sum([Count]) from data x where x.[Name] >= d.[Name])
from data d



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -