can anybody tell me how to extract hours from a datetime column?
i want to compare values like this , below ,
i have a close_time which is of datetime field.
need to compare,
if hour(close_time) < 4 ) and day(close_time )=1)
elseif (day(close_time ) =1 and day(close_time)=2)
elseif (day(close_time)>2 and day(close_time)=4)
i need to compare hour and day
hour function thrws error.
Please help as its urgent.
To isolate certain parts of a date field, you'll need to write a calculated field using the 'Datepart' function. So in your particular case, you would start with something like:
if datepart('hour',[close_time])<4 and datepart('day',[close_time])=1 then datepart('month',[close_time[)
Also check out the dedicated dates & times part of the forum: http://community.tableau.com/community/forums/content?filterID=content~category[dates-times]
Thank you so much for the response. This has solved my issue.