OK create this query
Code:
SELECT mytable.type, Sum(mytable.values) AS sumYTD
FROM mytable
WHERE (((mytable.dates) Between #01/01/2015# And Date()))
GROUP BY mytable.type
and save it as qryYTD
then create another query
Code:
SELECT mytable.type, Sum(mytable.values) AS Sum12m
FROM mytable
WHERE (((mytable.dates) Between dateadd("y",-12,date()) And Date()))
GROUP BY mytable.type
and sat it as qry12Month
then create a third query
Code:
SELECT DISTINCT mytable.type, YTD.sumYTD, Roll.Sum12m
FROM (mytable LEFT JOIN qryYTD ON mytable.type = qryYTD.type) LEFT JOIN qry12Month ON mytable.type = qry12Month.type
Year | Month | Type | SubType | Value
of these, all but SubType are reserved words and will cause problems. After 127 posts you should know this - and I'm sure you can reinterpret 'Value' as 'Values' etc. Also I suggest you put the dates back in - why did you change it?
rename them and tell me what they are now called and get the above three queries working and perhaps I can help with
If there
ARE NOT 12 months to "roll" on for a particular month, to show a
"-" or something to signifiy that there are not 12-months to roll on.