View Full Version : Charts Month switch


Jamet1234
03-11-2008, 05:59 PM
Hey Guys

I have to line charts that I trend Monthly. I noticed that I was using the wrong date field so I changed it in the SQL statments to the right one. Now my Months at the bottom of the graph do not go in order. If I start my trend from 12/1/07 to 3/1/08 The months at the botom of the graph go Dec'07 Feb'08 and then Jan'08. Why are Jan and Feb out of order? The other style graph that I am useing are not effected just the line graph.

Thanks

Anthony

namliam
03-12-2008, 02:05 AM
It is probably because the query is sorted by the format instead of the date.

Try changing the format to yyyy-mm-dd, see if that helps...

If you must have it like Feb-08, add a column with above format and sort on it.

Jamet1234
03-12-2008, 06:15 PM
Hello Guys

Maybe I asked this wrong Here is the SQL for my chart.

SELECT (Format([Date/Time Completed],"mmm"" '""yy")) AS Expr1, Sum(qryTrends.[Manhours Worked]) AS [SumOfManhours Worked]
FROM qryTrends
GROUP BY (Format([Date/Time Completed],"mmm"" '""yy")), (Year([Date/Time Completed])*12+Month([Date/Time Completed])-1);

Can anyone see why Access thinks Feb-08 come before Jan-08?
All I did was change to Date/Time Completed form Date Assigned.
Here is an other funny thing I tried to make a new chart and the chart wizard will not let me change Manhours Worked from count to sum. If I leave it count the months go in order, but once I go into the SQL and change it to sum Jan and Feb are out of order even if I change it back to count.

If I extend my trend through March the Graph displays Dec-07, Feb-08, Jan-08,
March-08. If I shorten my trend to Feb. through March the order is correct, but Jan. through March comes up Feb-08,Jan-08,Mar-08.

Any help would be great
Thanks
Anthony

namliam
03-13-2008, 01:29 AM
Like I said, because in a group by the ORDER is by default alphabetical... since you are using the MMM YY format the group by will "order by" Feb Jan... seeing as F comes before J.

Add to your query a field:
Order: format([date/time completed], 'yyyymm')
and order by that field (just hide it from view since no one is intrested in seeing it. But it will put Jan in front of Feb since 200801 < 200802

General things:
Why do you use "mmm"" '""yy" as your format when simply "mmm yy" works as well?

DONT use spaces in names of your Column names ... It will come to haunt you one day!

Jamet1234
03-14-2008, 06:19 PM
I got it to work. For some reason the Sort got erased. To answer your questioon about the syntax I did not write it the wizard did. When you use the wizard you can tell it how you want it to sort I.E. Month, Quarter. Thats the way it wrote. Thanks for your help and patients.

Thanks
Anthony