2 Replies Latest reply on Feb 18, 2017 1:32 PM by Miroslav Licek

    Date without hours

    Béatrice LORIOT

      Hi,

      I have 2 databases, one with date and hours, another one with dates only .

      I would like to join data on the day (without the hours) and can't find a proper way of doing it.

      There is probably a calculated field which could help me change the date with hours in date without hours, does any one know how to write it ?

       

      Thanks

      KR

      Béatrice

        • 1. Re: Date without hours
          Shinichiro Murakami

          Hi Beatrice

           

          Try this

           

          date([field date+hour])

           

          Thanks,

          Shin

          1 of 1 people found this helpful
          • 2. Re: Date without hours
            Miroslav Licek

            Hi Beatrice,

            what kind of DBs are you using? Do you need to do a join or can you blend it?

            1) Joining - in case you're using an SQL DB, you can simply cast the the field with time granularity as date, that would remove the time: e.g. cast (@mydatetimefield as date) as @mydatefield. Then you will be able to join the 2 sources.

            2) blending - if the relationship was created on the continuous date, make sure that you remove it and create the relationship only at the level which is common to both of the data sources: e.g. YEAR(@mydatetimefield), QUARTER(@mydatetimefield), MY(@mydatetimefield), MONTH(@mydatetimefield), WEEK(@mydatetimefield), DAY(@mydatetimefield). Another option is to create a new calculated field in Tableau and use datetrunc funtion and then blend on this new date field (e.g. datetrunc('day',@mydatetimefield).

             

            Hope this helps.

             

            Miroslav