10 Replies Latest reply on Jun 14, 2016 6:16 AM by ahmed.hasnaoui

    Gantt Chart Date Sort


      Hello all,


      I need help. I want to create a gantt chart for project overview.

      It should show me project start and end date as a horizontal bar.

      My problem is, that I want to sort the created date, so that the bars begin in top left and are sorted descending, and the latest project created date would be somewhere down right.

      This is how it looks right now:


      I followed this example:


      Example Gantt chart for schedule with milestone shapes


      I created a calculated field for the project duration with the datediff function:

      DATEDIFF('second', [Created], [Project End Date])/86400

      Date is in this format: yyyy-mm-ddThh:mm:ss (2010-03-31T08:45:57)

      I can't attach the workbook as it is sensible data but I tried something similar in the superstore example with order date and days to ship actual.


      Please help

        • 1. Re: Gantt Chart Date Sort
          Michael Hesser

          Hello Ahmed;

          Try this:

          (1) Drop the Created Date onto ROWS

          (2) Change it to Discrete (blue). In the example you provided, I changed Order Date to MDY, but since you're doing this down to the second, I think you only need to change it to discrete. If that doesn't work, create a calc that is the string of your Created variable. In your sample it would look like this


          (3) Sort on the field. Choose MANUAL. This *should* put the most recent at the bottom. If you've created a calc, you can sort up or down.

          (4) Unclick the Show Header property to hide the sort method.


          Please give it a try... let me know if you'd like me to attach the .twbx



          • 2. Re: Gantt Chart Date Sort

            Hello Miachael,

            thank you for your help and answer.

            I tried your instructions, the sorting kind of works now, but it is not what I wanted. The bars still don't begin top left and are descending like "stairs"



            maybe the .twbx would be more helpfull, so I can see if you have also understand my problem =)


            Thank you!!


            edit: I want to achieve a viz like this:




            edit: I solved it. I created a calculated field generating the string out of the date field, then I added it to rows as first, and now I can sort by these values.


            here is how it looks like, sorted descending in the upper screenshot and descending below.

            edit: while writing this, I realized, that you don't need a calc. field for this, just place your date field in the rows shelf as FIRST and select the date value you need (for me it was Day, so: May 8, 2015)


            Thank you Michael for your help you gave me the right direction!



            • 3. Re: Gantt Chart Date Sort
              Michael Hesser

              Glad I could help. Please see part (2) of my answer where I suggest creating a string out of the field

              • 4. Re: Gantt Chart Date Sort

                I knew I've read it somewhere

                however, like I mentioned it works now without that calc. field.


                Now I have another problem, I have some more date fields (1 to 5) that show me the date when a project started that phase, I added one to the column shelf and made it a shape type so I have a nice marker. How can I make this for all 5 date fields?
                I can't create five axes...

                Any idea?

                • 5. Re: Gantt Chart Date Sort
                  Michael Hesser

                  Could you provide a small .twbx?

                  • 6. Re: Gantt Chart Date Sort

                    I changed the example of the initial post to show what I mean:

                    I added 3 date columns:


                    I need all date columns visible as shapes (different shapes) in the visualization...

                    Please ignore the milestone sheet.

                    Please note, that I can't rearrange the data structure...


                    (How to attach a file?)

                    • 7. Re: Gantt Chart Date Sort
                      Michael Hesser

                      Hi Ahmed-- multiple dates can be tricky. You may find an answer here:

                      combine two date fields on same axis


                      Using this process, you should be able to create a dual axis: one for shapes, one for the bar between.


                      Alternatively (and I like this more), as long as the time between Phase 0 and Phase 2 is continuous, you can create a Reference Line to connect them. I think this is a little cleaner than the dual axis approach.


                      This might also help you, depending on your data structure. You can make a copy of the data, then pivot it so you can easily display the values by date:

                      Pivot Data (from Columns to Rows)

                      I was able to produce this:

                      Good Luck!

                      • 8. Re: Gantt Chart Date Sort

                        no luck

                        I retrieve data with ODATA connector from a sharepoint list, I don't have the grid view in the data source tab, I don't have the copy option and I also don't have the pivot option when I select multiple columns...I would like to punch a wall now

                        • 9. Re: Gantt Chart Date Sort
                          Michael Hesser

                          When in doubt: kettan


                          Did you check out Kettan's article on data joins? CROSS JOIN with Tableau's join dialog


                          I'm unclear about the shape of your data, but if they share a "dummy" value you may be able to thread the dates together using a cross join.


                          If you can't get to the data source grid view, this might not do you any good -- nevertheless, please check out this wonderfully-written article and see if there are some magic beans in there.


                          May I also suggest you post this as a new question (if you haven't already)? That way it will get more attention as an unanswered question.

                          • 10. Re: Gantt Chart Date Sort

                            thank you michael,

                            I don't know why Tableau's behaviour is like that with ODATA connection (and SP List).

                            I exported the data from SharePoint to Excel and then I imported it again to Tableau. Now the data is visualized in the grid view and I can do the pivoting like you showed me!

                            Thank you for your help so far. I surely will open a new question about this.


                            Cheers buddy, I really appreciate your help!