Sort by Month
Hi
I have create a site in which a solicitors add a client. When they add the client it automatially generates the date and put this into a field in my db called date added.It adds it dd-mm-yyyy. I want to be able to sort ignoring the dd. So if they wanted to see all the cases added in jan 2010 it would do so or if it was june 2010 we could do this.
Any suggestions on the best way to do this
First, if your datatype is char or varchar, change it to date or datetime, whatever is appropriate for your db.
Second, different dbs have different functions that will help you. What type of db do you have?
Similar Messages
-
Display Month verbiage on chart but sort by month number
Hello,
I have inserted a simple bar chart (values by month for a single year) and my goal is to get the data values to group by month.
I found that I can achieve this by using a formula that extracts the month from my Date/TIme field MONTH({Command.OB_DELIVERY_DATE}).
This works OK and displays months as 1, 2, 3, etc. on my chart), but I want to display the month text instead (Jan, Feb, Mar)
I tried a second variable: ToText({Command.OB_DELIVERY_DATE},'MMMM')
This works in displaying the verbiage of the months, however, the problem is that it groups the months on my chart alphabetically now (April is now my 1st month instead of January).
What is the trick to displaying month verbiage on my chart, but still sorting these months in their proper numerical order?
Many Thanks!Hi Dave,
Try this please:
1) Insert a Crosstab and place it on the Report Header. Use the Delivery Date field as the row and add the measure field as the Summary Field with the right Sum function
2) Highlight the Delivery Date field > Group Options > set it to print 'For Each Mointh'
3) While in the Crosstab Expert highlight the Delivery Date field > Click Group Options > Options tab > check the option 'Customize Group Name field' > Select 'use formula as group name' and click the formula button beside. Use this code:
ToText({Command.OB_DELIVERY_DATE},'MMMM')
4) Right-click the Crosstab and select Insert Chart. Choose the right Chart Type
5) Suppress the Section that holds the Crosstab
Hope this helps.
-Abhilash -
How do I sort by month ? using the "Month" format
Hello All,
Is it possible to sort by month using the follwoing SQL.
Select TO_CHAR (RCA_CLOSE_DATE, 'MON-YY') "Month",
SUM (ADJUSTMENT_INCL_GST)
From My_Table
Group By TO_CHAR (RCA_CLOSE_DATE, 'MON-YY')
Output
Month Sum(Adjustment Incl Gst)
APR-06 $6,539,983.08
AUG-06 $23,122,705.31
FEB-06 $14,365,106.52
JUL-06 $19,776,122.04
JUN-06 $20,161,278.12
MAR-06 $8,248,955.87
MAY-06 $18,498,683.04
NOV-06 $24,120,095.49
OCT-06 $12,781,721.23
SEP-06 $15,632,604.21
Hope someone can help
FrankIf the desired sort order is MM-YYYY, then how would...
ORDER BY
TO_CHAR(RCA_CLOSE_DATE, 'MM-YYYY') ...not achieve this?
Perhaps the original poster could clarify what they mean by "sort by month". In numeric order by month then year, in numeric order by year then month, or in some other order?
If you do not like TO_CHAR, another approach (again assuming "numeric order by month then year" is what is desired) might be:
SELECT
TO_CHAR(RCA_CLOSE_DATE, 'MON-YY') AS MONTH,
SUM(ADJUSTMENT_INCL_GST) AS TOTAL
FROM
MY_TABLE
GROUP BY
EXTRACT(MONTH FROM RCA_CLOSE_DATE),
EXTRACT(YEAR FROM RCA_CLOSE_DATE),
TO_CHAR(RCA_CLOSE_DATE, 'MON-YY')
ORDER BY
EXTRACT(MONTH FROM RCA_CLOSE_DATE),
EXTRACT(YEAR FROM RCA_CLOSE_DATE)In any event, in a query with GROUP BY clause:
1. The expression(s) in ORDER BY clause do not need to appear in the SELECT clause.
2. The expression(s) in ORDER BY clause do need to appear in the GROUP BY clause (unless you want to order on the result of an aggregate expression, like involving SUM, which does not appear to be the case here).
3. Expressions in the SELECT clause do need to appear in the GROUP BY clause, unless they are aggregate expressions, like involving SUM.
Hope this helps.
P.S. If the desired order is "in numeric order by year then month", then you might use TRUNC like this:
SELECT
TO_CHAR(RCA_CLOSE_DATE, 'MON-YY') AS MONTH,
SUM(ADJUSTMENT_INCL_GST) AS TOTAL
FROM
MY_TABLE
GROUP BY
TRUNC(RCA_CLOSE_DATE, 'MONTH'),
TO_CHAR(RCA_CLOSE_DATE, 'MON-YY')
ORDER BY
TRUNC(RCA_CLOSE_DATE, 'MONTH')Doing the TRUNC in a subquery and formatting the result in the outer query as John has suggested may be more efficient. -
How to sum time values sorted by month/year?
I would like to sum time values that are sorted by month/year. (Concept is based on a pilot's logbook)
In Table 1, Column A is a date; Column B is the associated time value (duration).
In Table 2, I would like to Sum the time value of Table 1 Column B by month an year.
TABLE 1
Date
Time
Header 3
Jan 1, 2013
2:30
Jan 3, 2013
4:15
Jan 9, 2013
3:55
Feb 2, 2013
5:01
Feb 10, 2013
1:33
March 3, 2013
5:55
TABLE 2
Month/YR
Total Time
Header 3
Jan-13
10:40
Feb-13
6:34
Mar-13
5:55
Apr-13smash,
Here's an example of what can be done:
The formula in the Total column of Summary is:
=SUMIFS(Log :: B, Log :: A, ">="&A, Log :: A, "<"&EOMONTH(A, 0)+1)
The Month column of Summary is filled with a series of dates that can be formatted as Jan-13, etc, if you wish.
I used the 0h 0m format for the Durations to distinguish it from times.
Jerry -
I have two database fields, "Month" and "Year" which will be combined in a formula for the purpose of a chart.
(eg: "{Table.Month}" and "{Table.YEAR}" = January 2008)
My question is, if I use a line chart, how can I have Crystal sort the Month/Year properly instead of having it sorted alphabetically like it is already doing?
As of right now, I'm getting April 2007, April 2008, August 2007, August 2008, etc...Try to create a formula to return a perfect date format by combining both month and year. Also try to combine a day value as 1 so that you will get a complete date. Now use this formula in chart and click on order button and choose group by monthly.
Hope this Helps!
Raghavendra -
Sort the month name column based on month id in rpd itself only
sort the month name column based on month id in rpd itself only without creating the logical column.
Hi,
sort the month name column based on month id in rpd itself only without creating the logical column. Can you be bit specific?
Is this what you want..http://www.biconsultinggroup.com/knowledgebase.asp?CategoryID=198&SubCategoryID=368
Regards,
Srikanth
http://bintelligencegroup.wordpress.com -
Sort By Month Name in Crosstab report
Hi,
I have one cross tab report in which in Datapoint I have one column which shows Month Details. When I run the reports the heading of Column comes as Month Name (ie Aug, April, Dec,.....) . Can you please help me to understand how can it be done it displayed in sorted month according to Month Name (ie. Jan, Feb, Mar, Apr.......). As per one of the Thread I tried to use to_date(Column_name) but it does not work as Column name is char column and cannot be converted to date.Hi ,
What if you use the following ...in bold?????
SQL> select ename,hiredate from emp;
ENAME HIREDATE
SMITH 18/12/1980
ALLEN 20/02/1981
WARD 22/02/1981
JONES 02/04/1981
MARTIN 28/09/1981
BLAKE 01/05/1981
CLARK 09/06/1981
SCOTT 18/04/1987
KING 17/11/1981
TURNER 08/09/1981
ADAMS 21/05/1987
JAMES 03/12/1981
FORD 03/12/1981
MILLER 23/01/1982
14 rows selected
SQL> select hiredate , to_number(to_char(hiredate,'MM')) from emp order by 2;
HIREDATE TO_NUMBER(TO_CHAR(HIREDATE,'MM
23/01/1982 1
20/02/1981 2
22/02/1981 2
02/04/1981 4
18/04/1987 4
21/05/1987 5
01/05/1981 5
09/06/1981 6
08/09/1981 9
28/09/1981 9
17/11/1981 11
18/12/1980 12
03/12/1981 12
03/12/1981 12
14 rows selectedOR ....
EVEN BETTER AS YOU NEED THE MONTH NAME....
SQL> ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN';
Session altered
SQL> select hiredate , to_char(hiredate,'MON') , to_number(to_char(hiredate,'MM')) from emp order by 3;
HIREDATE TO_CHAR(HIREDATE,'MON') TO_NUMBER(TO_CHAR(HIREDATE,'MM
23/01/1982 JAN 1
20/02/1981 FEB 2
22/02/1981 FEB 2
02/04/1981 APR 4
18/04/1987 APR 4
21/05/1987 MAY 5
01/05/1981 MAY 5
09/06/1981 JUN 6
08/09/1981 SEP 9
28/09/1981 SEP 9
17/11/1981 NOV 11
18/12/1980 DEC 12
03/12/1981 DEC 12
03/12/1981 DEC 12
14 rows selectedRegards,
Simon
Message was edited by:
sgalaxy -
All,
I'm trying to display "Mon" (i.e. Jan, Feb, Mar, ...), but sort by "MM" (i.e. Mar, Apr, May) but am having issues with the query. This is the query I'm trying to run:
<pre>
select null link, to_char(date_created, 'Mon'), count(applicant_id)
from applicant
group by null, to_char(date_created, 'Mon')
order by to_char(date_created,'MM')
</pre>
Looking for some advice on how to sort by the cardinal month value while displaying the month name value.
Thanks.One solution would be:
select null link, createdate, cnt
from ( select to_char(date_created,'MM') sortdate, to_char(date_created, 'Mon') createdate, count(applicant_id) cnt
from applicant
group by to_char(date_created,'MM'), to_char(date_created, 'Mon')
order by sortdate -
Sorting a Month Column Ascendingly
I have constructed a time series with an ago fuction but I have a littile problem with my Month Column(Varchar), it wont sort Ascendingly ,ie Jan ,Feb,March, April ect, Instead , it is retuning radom results ie jan. march , August etc. I have tried everything possible to get it to sort Ascendinglily to no avail. but it wont sort. Please , help.
Thanks
LarryCreate a dummy column (Month Column In your scenario) in answers use the following code in fx:
case when columnvalue= 'Jan' then 1 when columnvalue= 'Feb' then 2 .......... when columnvalue= 'Dec' then 12 end
enable asc sorting order on this column you can hide this column.
Note: Replace the columnvalue with the name of your original column.
Award points and close this thread if your question is answered.
-Amith. -
What sort of monthly data usage does the iphone use up?
Hi,
Hope this is the right place to ask this. I'm getting an iphone 4 in a couple of weeks, and have been looking at the priceplans available.
They all seem to only give 500mb data allowance, what shocked me was to read this on vodafone's site :
*500MB a month will let you read and reply to approximately 100 emails, view 92 BBC news stories, and browse around 44 mobile web pages - every day. And 1000MB will let you read and reply to approximately 200 emails, view 184 BBC news stories, and browse around 88 mobile web pages.*
whereas T-mobile say :
*With 500MB of data you could do one of the following (roughly):*
** Send 500,000 emails without attachments*
** Send 1000 emails with photo attachments*
** 5000 visits to simple sites like Twitter or blogs*
** 1500 visits to rich content sites like bbc.co.uk, guardian.co.uk and so on*
** Download 50 low quality or 12 high quality tunes*
** Watch 60 views of 4.5 minute YouTube™ videos*
Obviously therefore i feel that vodafone have massively screwed up on their website there, and am guessing T-mobile have got the more accurate description of what 500mb data allowance can give you.
Just wanted to ask you iphone-ers whether you find yourselves going over 500mb of data allowance each month? I wouldnt be a heavy user of downloading things, but i would like to use all the aps and browse the web now and then like every other iphone user out there, so just want to gauge whether to go for a contract with a larger allowance, and less minutes, or whether 500mb per month is a perfectly reasonable amount!
Thanks in advanceYour question although entirely reasonable, can be paraphrased as 'how long is a piece of string?'
I'm fine and I have an unlimited usage account (one of the old ones that they do not have any more).
I still don;t use more than 500mb but then again I have access to Openzone and The Cloud wifi which covers much of London, and airports. That usage isn't metered.
I have no idea if it is enough for you as we are completely different. -
Cal Month Sorting in BO Explorer
Hi All,
I have created an Information space on an universe which is based on BEx query.
I have a cal month object used in the info space.
My problem here is i am not able to sort it in the standard order (from jan to dec) but it is sorting either based on the value or alphabetically.
is there any way we can sort the month in the format from Apr to Dec ?
Plase help me out.
Thanks in advance,
Ravi.Hi Alex
I could not see the option to change the facet type. I am creating the information space on top of universe created in UDT with the source as BW. In the universe I gave the Calendar Year as Char. And while creating Information Space I gave the dimension as Months(Jan.. Dec).
But it still did not help me.
Where can I change the type for the facet that I have used.
(Attached is the image of selecting the dimension of the facet, in Configure Informaton Space) -
Problem of sorting month name in pivot table
Hello,
I have a month name that is sorted by month number in my repository.
When I select Year + month name + measure sorted by year then by month name and I look the result in a table, everything works perfectly but when I switch to a pivot table the sorting doesn't work : the pivot table sorts my month name in an alphabetical order instead of using the month number .... Is it normal ?
To find a solution, I have added my month number and I have sorted by year then by month number and I have hidden my column month number. This have solved my problem for the pivot table but if I attached a chart to it (by selecting "Chart Pivoted Results"), the label of the bottom axis contains the month number and the month name and I haven't found where I can hide this month number. Why the hidden option only works on the pivot table and not on the pivot chart ? And how I can do that ?
Thanks in advance for your help.No there is no Transient attribute involved , could you please tell me what might cause this error .
Basically this page is for inserting a record.
Thanks ,
Keerthi
Edited by: user1140193 on Oct 21, 2011 7:15 AM
Edited by: user1140193 on Oct 21, 2011 7:16 AM -
Month Sort Order Problem in Time Dimension(Essbase with Obiee)?
Hi All,
I am facing issue with month order in answers.
First I created BSO cube using Essbase Studio. When i exposed cube in answers, months were sorted in alphabetical order. So i used RANK function with evaluate to arrange month members in proper order. But if i use RANK function it pulls all missing records and it is effecting performance.
Then i created Time dimension(dimension loading) in essbase from FLAT file,initially it was coming in proper order. But after some time again it sorted in alphabetical order!!!
I have seen in internate few people saying they didn't face this problem. I
Please advice...
Essbase: 11.1.1.3
OBIEE: 10.1.3.4.1
RSHi user10300020,
That's a fairly common problem with months that happens regardless of database source.
In the logical layer of OBIEE you can specify the sort order on the month name column. Just double click on the month name column and look for the option to set sort order based on a different column. I typically sort the month name based on the month number.
Give that a shot and tell me if it works.
-Joe -
Applying Sorting for the Month Field
Hi,
When i apply sort to the month-name field for each quarter(Q1,Q2..), it sorts as 1)February 2)January 3)March..
Its sorts the month-name field in alphabetical order(F,J,M) not in the usual 1)January 2) February 3)March order..
To sort this issue i added the numeric field called month with values 1,2,3..
How to sort the month-name field as January, February???And if you're still struggling, [read this|http://blog.davidg.com.au/2011/03/sorting-months-in-webi.html].
-
I created a smart group which includes all cards with a birthdate field.
I want to print the group showing just the birthdates (I know how to do this).
Anyway I can sort the list by birthdate??? Actually I would like it sorted by month and day.
Thanks,
silvlia
dual 2.5 G5 Mac OS X (10.4.7)select pt.phone_no, p.preferred_name_upper, se.grade,
decode(:p_order1,'A',p.preferred_name_upper,'B',p.birth_date,'C',p.birth_date) order1asc,
decode(:p_order1,'A',pt.phone_no,'B',pt.phone_no,'C',pt.phone_no) order2asc
from student_program_class_tracks spct,
persons p,
school_classes sc,
student_enrolments se,
person_telecom pt
where p.person_id = spct.person_id
and p.person_id = pt.person_id
and se.person_id = p.person_id
and se.school_year = sc.school_year
and se.school_code = sc.school_code
and sc.school_code = spct.school_code
and sc.class_code = spct.class_code
and sc.school_year = spct.school_year
and sc.school_code = 'BRE'
and sc.school_year = '20052006'
and se.school_code = 'BRE'
and se.school_year = '20052006'
and se.grade is not null
and se.active_flag = 'x';
Maybe you are looking for
-
Not sure if I'm repeating myself here, but here is a repeat: HI, my friend has updated her iPad to iOS8 and has since lost sight of anything she types, ie, email, chat in games, etc. can anyone help, please?
-
I'm having a problem with my disc drive. It's reading CD's, but having trouble with DVD's. Sometimes it will load them, but the majoity of the time it'll just eject them. I did the PRAM and SMC resets, i.e. talking out the battery while the comp is o
-
Zooming whenever I double-click on any margin of pages with Hand Tool or Selection Tool selected
I have used Acrobat and recently upgraded it to Acrobat XI in order to use it with my tablet PC. But whenever I double-click with my digitizer pen, with Hand tool or Selection Tool selected, on any margin of pages, it zooms in. i.e. it automatically
-
Create Create table statement dynamicallly
I am trying to create a SP that return a "Create table "statement dynamically using a table called "Employee" in database. How can I create a dynamic Create Table statement using sys.table? The create table statement should contains all the columns
-
Functionalities In Incentives and commission Management
Hi Folks Can Any body share the detailed information on Incetives and Commission Management,What are functionalities are involved and related Tcodes. I shall be very greatfull if you can help me in this reagrd. Thanks & Regards Vikram