Q:

Adding a date condition to Sheets query

So I have 2 formula's, 1 of them sorts the data by month and displays it, sorts it by ASC, and adds a label
The data looks like this:
Date Name Amount
=query( 'List'!A2:K; "Select A,B,J  Where toDate( A )<=  date '"& TEXT( EOMONTH(DATE( 2018;9;1) ; -1)  ; "yyyy-MM-dd" ) & "'and toDate( A ) >=  date '"& TEXT( EOMONTH( DATE( 2018;8;1) ; -1)+1  ; "yyyy-MM-dd" ) & "'order by B Asc label A 'August' ")

The other one works with the same data, but actually groups by name, and sums the amount.
=query('List'!A2:K; "select B, sum(J) Group by B Label sum(J)''  ")

How would I go about joining them together to get
Sum, for specific(grouped) Name in a certain date period? In a way that it would still have a label with what month it grouped it by.

A:

Solved it a little differently
=query((filter('List'!A2:J;'List'!A$2:A>=(EOMONTH("01.08.18";-1)+1);'List'!A2:A<=EOMONTH("01.08.18";))); "select Col2,  sum(Col10), count(Col2) Group by Col2 order by sum(Col10) Label Col2 'Agent (August)',sum(Col10) 'Total Sum', count(Col2) '# of purchases'   ")

