6 Replies Latest reply on Nov 21, 2016 7:20 PM by Shinichiro Murakami

    Calculating week numbers

    emre.kekec.0

      Hi all,

       

      I am new to Tableau, therefore please excuse my ignorance in advance.

       

      I am trying to create a dashboard for visualizing activities and tasks in the projects that we run. I currently have nearly ten projects, and each of these have six gateways. Lengths of those projects differ from 18 months to 36 months, but all follows the same gateway structure. I am going to show the progress of the project activities like a gantt chart, and would like to show the project timeline (with week numbers) on the top.

       

      I have a data table similar to this:

       

       

       

      Do I need to create data a table with week numbers, dates, and gateways, or is there a way to calculate dates and week numbers by using the gateway dates.

       

      Any help will be much appreciated.

       

      Thanks.

       

      Message was edited by: Emre Kekec

        • 1. Re: Calculating week numbers
          Mahfooj Khan

          Hi,

           

          You don't need calculate week numbers. Its already there in your Gateway Date field. Just drag your date field in canvas and select your desired date part like this.

          Let me know If this help.

           

          Mahfooj

          1 of 1 people found this helpful
          • 2. Re: Calculating week numbers
            Sujay Paranjpe

            Hi Emre,

             

            In addition to what @mahfooj khan has mentioned. You can create a calculated filed as below

             

            "W" + STR (DATETRUNC('week', <Date column>))

             

            Best,

            Sujay

            • 3. Re: Calculating week numbers
              emre.kekec.0

              Hi,

               

              Thank you for that suggestion, however it does not work for me.

               

              There are two date inputs:

              1) Project timeline, on the top, comes from project gateways and I want to show week number with corresponding dates. Project timeline will change as per the selected programme's gateway dates.

               

              2) Activity dates, at the bottom, comes from the activities that are part of Subprojects.

               

              When I tried your suggestion, I ended with the below:

               

               

              New columns are added to the dashboard. Am I doing something wrong here?

               

              thanks.

              1 of 1 people found this helpful
              • 4. Re: Calculating week numbers
                Sujay Paranjpe

                Hi Emre,

                 

                Please share sample data (not as image pls) to re-create the Viz. I think what you are targeting is easily achievable.

                 

                Best,

                Sujay

                • 5. Re: Calculating week numbers
                  Bora Beran

                  One issue could be the definition of the week which in this case would be the week of the year which is effected by the first day of the week. You can change this under Data > name of your data source > date properties.

                   

                  Another thing to consider is to use a Gantt chart instead of dual axis dates.

                   

                  You can do a datetrunc to get the first day of the week for the project.

                   

                  DATETRUNC('week',yourdatehere) and then do a DATEDIFF to get how many days between the beginning of the week and the end. You can use this on the size shelf to scale your bars accordingly.

                   

                  DATEDIFF('day', DATETRUNC('week',[Date]),[Date])

                  • 6. Re: Calculating week numbers
                    Shinichiro Murakami

                    Emre,

                     

                    I have created some sample.

                     

                    [Days at GW]

                    lookup(min([GW Start]),1)-min([GW Start])

                     

                     

                     

                    or

                    or If you need detail and have enough space.

                    You can show Each start date with ref line,

                     

                     

                    Thanks,

                    Shin

                    1 of 1 people found this helpful