Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Libreoffice Base: Cumulative sum
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Sun Oct 09, 2011 9:41 pm    Post subject: [Solved] Libreoffice Base: Cumulative sum Reply with quote

Hi all, I am new to libreoffice base, so I decided to ask you an advice. I want to create, in a query, a new column with cumulative sum such as:

A SUM
1 1
2 3
3 7

Could you help me?

Thanks


Last edited by yellowhat on Mon Oct 17, 2011 7:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10459
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Oct 09, 2011 9:47 pm    Post subject: Reply with quote

Moved from Other Things Gentoo to Desktop Environments. Not about Gentoo so it fits better here (I think).

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Wed Oct 12, 2011 6:21 pm    Post subject: Reply with quote

Any ideas?
Back to top
View user's profile Send private message
wizulis
n00b
n00b


Joined: 07 Nov 2010
Posts: 46

PostPosted: Thu Oct 13, 2011 6:19 am    Post subject: Reply with quote

If I understand correctly what you want, then it is pretty easy:

Assuming that the

"A" is in cell A1 and "1" is in cell A2 and "2" is in cell "A3" just write in B2

=sum($A$2:A2)

Then push enter, select the cell again and pull it down by the square in the right bottom corner of the cell.
Back to top
View user's profile Send private message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Thu Oct 13, 2011 6:26 am    Post subject: Reply with quote

Thanks for reply but my question was about creating a query in libreoffice base not calc.
Back to top
View user's profile Send private message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Sat Oct 15, 2011 3:07 pm    Post subject: Reply with quote

Anyone know how to write this query in sql for libreoffice base?
Back to top
View user's profile Send private message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Sat Oct 15, 2011 4:32 pm    Post subject: Reply with quote

This is quite good:

SELECT "ID", "Quantita", (SELECT SUM("Quantita") from "Tabella1" WHERE "ID" <= "ID") AS "Running Total"
from "Tabella1"

But as result I get:
1 10
2 10
3 10
4 10

It is not progressive but something must be changed here: WHERE "ID" <= "ID"
Back to top
View user's profile Send private message
yellowhat
Guru
Guru


Joined: 10 Sep 2008
Posts: 512

PostPosted: Mon Oct 17, 2011 7:23 pm    Post subject: Reply with quote

This works perfectly

Code:
SELECT
   "A"."ID",
   "A"."Quantita",
   ( SELECT SUM("B"."Quantita")
     From "Tabella1" as "B"
     WHERE "B"."ID" <= "A"."ID") AS "Running Total"
From "Tabella1" as "A"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum