It's been about 5 years since I wrote any queries and I'm kinda stumped on this simple one. Hopefully after this it will trigger some of what I learned the first time around.
I am trying to group this table by fiscal year and commodity. Then I want to sum the totals to get a year to date total for each. This would be current year to date for one and then what it was a year ago for the other fiscal year to understand what I'm doing. Every time I try to write it I get the aggregate function error. I was thinkin I could group by fiscal year and commodity and just do a sum to at least get me close but I can't even get reletively close.
My query is currently.
SELECT [Container Tons].[Fiscal Year], [Container Tons].Period, [Container Tons].[Fiscal Month], [Container Tons].Port, [Container Tons].Commodity, Sum([Container Tons].Tons) AS SumOfTons
FROM [Container Tons]
WHERE [Container Tons].Period <= 4
GROUP BY [Container Tons].[Fiscal Year], [Container Tons].Commodity
Bookmarks