7 Replies Latest reply on Jan 2, 2019 7:57 AM by Ken Flerlage

# Problem sorting semesters

Hello

I'm trying to fix a sorting issue in a Tableau workbook.

Here is the workbook.

Ideally, I'd like Summer '18 to precede Fall '18. In the Excel spreadsheet, the semesters are text fields, not dates. I suppose that I could just dummy up a date and recreate the tabs. That seems like too much work. Oddly, this worked for 2016 and 2017. For some reason, it's not working now. I've sorted the data in chronological order but that doesn't seem to matter.

I've searched the forums for custom sort options and I'm not having any luck.

Any ideas, Tableau wizards? Thanks.

• ###### 1. Re: Problem sorting semesters

You'll need to create a calculated field that makes it sortable. I'd suggest something like this:

Semester Numeric

// Create a numeric value for our semester from the year and semester.

// Using UPPER to ensure we don't have any case issues.

RIGHT([Time],4) +

IF UPPER(LEFT([Time],6))="SPRING" THEN

"01"

ELSEIF UPPER(LEFT([Time],6))="SUMMER" THEN

"02"

ELSE

"03"

END

Then, on that sheet, right click on the Time pill (on the columns shelf) then select "Sort" and set it up as follows:

That should give you the result you're looking for.

=

See attached.

• ###### 2. Re: Problem sorting semesters

Hi Phil,

Your date field is currently a String so it's sorting in alphabetical order.  You can either create a date field to go along with it like you said, or you can manually sort the field like this:

Best,

Paul

• ###### 3. Re: Problem sorting semesters

Hello Phil,

Not sure whether this is what you need:

Looking at the 'Buckets' worksheet I see where you manually sort the 'Time' Dimension on the Columns shelf.  I at least was able to modify the sort order as desired including moving Summer '18 before Fall '18.  The 'Buckets by Semester' view within the 'Tabs' Story did update accordingly.

Thanks,

Will

• ###### 4. Re: Problem sorting semesters

This looks easy enough, Will,

Which tab were you on to do this? Thanks!

• ###### 5. Re: Problem sorting semesters

I figured it out and updated this on my site.

Thanks, all!

• ###### 6. Re: Problem sorting semesters

Hello Phil,

It was the second tab titled 'Buckets'.  Paul provided a screenshot of what will appear when you click 'Time' followed by the Sort menu option.

Thanks,

Will

• ###### 7. Re: Problem sorting semesters

Just be careful with the manual sort method. It works in this case, but if you add in new semesters down the road, it will break. If you don't have plans to update this with new data, then no worries. But, if you do, you'll be better off with a more automated solution.