Re: Cumulative Sum per month

2020-03-14 Thread Mario Bisiani
flat=True) > cumsum = np.cumsum(raw_data) Il giorno mercoledì 11 marzo 2020 16:42:57 UTC+1, Mario Bisiani ha scritto: > > Thank you Micheal. This function is the OVER clause of sql. I think the > running sum in a chart is a very common thing and I would like to know if > someone has

Re: Cumulative Sum per month

2020-03-11 Thread Mario Bisiani
1, Michael Macintosh ha scritto: > > You might want to use window functions > > > https://docs.djangoproject.com/en/3.0/ref/models/expressions/#window-functions > > to calculate the sum per month. Haven't personally used them yet though. > On 3/11/2020 8:27 AM, Mario Bisi

Re: Cumulative Sum per month

2020-03-11 Thread Mario Bisiani
Yes. I am using Chart.js. Any help? Il giorno giovedì 5 marzo 2020 13:42:18 UTC+1, krnrrr ha scritto: > > what do you mean by "cumulative"? if we have aggregate sums like > > jan = 100 > feb = 150 > mar = 120 > > you want to have output as > > jan = 100 > feb = 250 > mar = 370 > > ? > -- You rec

Cumulative Sum per month

2020-03-03 Thread Mario Bisiani
Hi! I would like to know the best way to have the cumulative sum per month plottable to chartjs for example. My models.py has one field for date and one for decimal number. Thanks to you all! -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Get last instance object per each month and sum per month in Django

2020-02-26 Thread Mario Bisiani
w how to do it > in Django orm but in sql is the most effective way to solve the issue and > it's a lot let expensive than taking all the activities and then search in > the status Table. > my 2 cents > Agnese > > On Tue, 25 Feb 2020 at 21:07, Mario Bisiani > w

Re: Get last instance object per each month and sum per month in Django

2020-02-26 Thread Mario Bisiani
i a écrit : >> >> You should search how to make a group by activity and a partition by >> month then take each partition and sum the record up, i don't know how to >> do it in Django orm but in sql is the most effective way to solve the issue >> and it's

Get last instance object per each month and sum per month in Django

2020-02-25 Thread Mario Bisiani
I tryed to search for answer but nothing yet can help me. I have one class model Activity and a class model Status : class Status(models.Model): activity = models.ForeignKey(Activity, on_delete=models.CASCADE, related_name="all_status") status_date = models.DateField() actual_progr

Calculation field - best practice

2020-01-21 Thread Mario Bisiani
Good morning, first post here! I have a quesion for you. I need to have a calculated field from two attribute of different class in model.py. Which is the best practice to perform calcs : in model.py by function or in the view.py? In the case of model.py how can i access the atribut of the dif