Forum Discussion
Sorting by Month Number
Why doing such a long process. Instead try doing this.
Goto queryeditor, duplicate your month column and transform to MonthNumber and rename it any name and apply.
Now in modeling tab , use this new named column to sort the month column.
pxg08680 how do I transform to month number. I am new to this. Help me with some steps. I have a month name column. Thank you!
- pxg086808 years agoResolver III
Do these steps
STEP1: Goto Home, EditQueries.
STEP2: Select the Month column that you have, right click and goto transform-->Month-->Month. This gives you month numbers.
STEP3: For same column right click and rename it to MONTHNUMBER.
STEP4: Close& Apply.
STEP5: Select the Month column from your data and got to modeling tab, sort column, select the newly created column, sort by MONTHNUMBER.
This should work.
- rarora208 years agoRegular Visitor
After right clicking I dont see the month--> month option.
- pxg086808 years agoResolver III
I am sorry, I was thinking that your data has a date column. What I posted works for Date fields.
You can do a switch kind of statement.
STEP1: In EditQuery, duplicate your month column to M# or any name. Close & Apply.
STEP2: Now create a new column this way...
column = IF(Table1[M#] = "January",1,
IF(Table1[M#] = "Feb",2,
IF(Table1[M#] = "March",3,
IF(Table1[M#] = "April",4,
IF(Table1[M#] = "May",5,IF(Table1[M#] = "June",6,
IF(Table1[M#] = "July",7,
IF(Table1[M#] = "August",8,
IF(Table1[M#] = "Sep",9,
IF(Table1[M#] = "Oct",10,
IF(Table1[M#] = "Nov",11,
IF(Table1[M#] = "Dec",12 ))))))))))))
Now sort you Month column with the newly create column.