forums
Use these forums to ask questions and discuss Tableau.
Time of day
Posted August 14th, 2008 by Zygor
I have an Access database I'm sitting Tableau on. It has a Date/Time field. I just want Tableau to use the time portion of the field. Is there a way to do this?
Comments
Absolutely! You can use just the time portion of the field in your analysis by changing the date level of the field. You can change the date level of the field to hour, minute, or second depending on the level you want to aggregate by. You can change the date level using the field menu of the field on a shelf. Refer to the online help for more information about this.
Tableau doesn't have a Time data type. That is, generally times don't exist without a date. To get just the time you could create a calculated field that looks like this:
DATETIME([Date]-INT([Date]))The above formula is a little bit gross because it relies on the fact that a date/time field is really just a number. For example if a date/time translates to 3.4 it means that the time is 4/10ths of the way through day 3. So if you subtract date-int(date) or 3.4 - 3 you get .4 which equals 4/10ths of the way through day 0. When you convert that back into a date/time you get just the time.
Keep in mind, when you use a formula like this each time will still have a "date" that is equal to day zero, which is 12/30/1899.