June 11, 2008 at 10:20 am
Hello,
I am trying to calculate a running total that changes on a daily basis in a view. For example:
I need to calculate the current row - the previous row (todays gallons - minus the previous days gallons to calculate the total gallons for a given day)
I have had a difficult time finding examples of subtraction row by row.
I was able to calculate the running totals, but the day by day values are proving to be more difficult.
Thanks,
Also PS I am not sure how to post tables/code to the forum. Does anyone have instructions for doing this?
June 11, 2008 at 10:34 am
Heyyyyy how about that i figured out how to post like a normal person. I included a shot of the table. I would invision the first row being 12900
2nd row: 180256-129000 = 51256
---Thanks
[SELECT
IssuedDateTime,
[Daily Reading],
---====Current Day - Previous Day = Daily total
[Daily Reading] - [Daily Reading] as DailyTotal,
RunningTotals
FROM z_v_RunningTotals
WHERE (SurveyRefID = 'e984c178-120b-4eab-a562-356e76d692ed') and IssuedDateTime < '5/1/2008'
Group By IssuedDateTime, [Daily Reading], RunningTotals
Order By IssuedDateTime
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply