Skip to content
Advertisement

how to calculate the previous total with the current total with group by

I need to calculate every month with the previous months like:

for each account.

so how can I do it, I tried to extract the totals by each month but I didn’t get any result.

DDLs:

example of my data for the specified user is:

this is the result that gives me:

what I need now is: how to calculate the previous total with the current total for each account and month. I tried the next code but it didn’t work, it gives me the wrong numbers:

Advertisement

Answer

I solved part of the issue:

but I want the CurrentTotal to be (PreviousTotal+Current)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement