SQL Server Performance Forum – Threads Archive
RunningValueI have a report which has a table with a single grouping (AccountGroup). Within that group I need to have a running total displayed on the detail line for that group, but I just can’t get anything to work!!!!<br /><br />I’ve read about the RunningValue function in the BooksOnline which looked like what I needed, but if I try to use it on the detail I get an error saying that I cannot use an aggregate function (RunningValue) in a sort expression. There isn’t a sort anywhere on my report so I assume it is the grouping that they are actually talking about.<br /><br />Anybody know how to get around this? All I want is a running total for a column within a group! It cannot be that hard, but I guess its late in the afternoon and my brain is fried <img src=’/community/emoticons/emotion-5.gif’ alt=’;-)’ /><br /><br />Thanks!
FYI, I wasn’t able to find a way to elegantly do this so I ended up having to use a cursor in a stored procedure to calculate the running total and then use a temp table to store them and report on the temp table. Not the way I was hoping to do it, but works for now.