Skip to Content
author's profile photo Former Member
Former Member

Month By month By Year comparison

Post Author: nick7777

CA Forum: Formula

I am a novice Crystal User attempting to compare data by month and year. The data is stored by date (mm/dd/yyyy) and I would like to compare Jan 2005 with Jan 2006 and Jan 2007 then Feb 2005 with Feb 2006 and Feb 2007etc... in a bar chart

Many thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 06:21 PM

    Post Author: DesertRecluse

    CA Forum: Formula

    Create 2 formulas that get the datename for month and year. Create a third formula that concatenates the two. Your result would be January 2005, January 2006, February 2005 and so on. Then put the first 2 formulas in the report where you can sort them - you can hide them and that way you won't see them but the data will sort on them. If you sort by month, year you will get all the January data together (Jan 2005, Jan 2006, Jan 2007...) and then all the February data.

    I would do this in the SQL along with the sorting instead of Crystal but you can do it in either. In the SQL you could create a single field in the select statement to use in the report but in the Order By clause you could do something like:

    ORDER BY DATENAME(month, StartDate), DATENAME(year, StartDate)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 06:27 PM

    Post Author: DesertRecluse

    CA Forum: Formula

    Sorry; that should be using DATEPART for the ORDER BY so that the integer data is sorted - otherwise the months will be sorted alphabetically. You would use the DATENAME function to create the concatenated field of January 2005.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.