Arnab Sengupta
Arnab Sengupta

Reputation: 1

Hour conversion in Tableau

I have a data-set that has time (hours) data in it.

The time data is given as 0.1123, 3.1565, 0.2951 etc (all in hours).

How do I convert it into standard hours and minute format?

Upvotes: 0

Views: 553

Answers (2)

Alex Blakemore
Alex Blakemore

Reputation: 11919

Floor([value]) = the number of hours

Floor([value] * 60) % 60 = the number of minutes

Floor([value] * 3600) % 3600 = the number of seconds

Upvotes: 0

Shriram R S
Shriram R S

Reputation: 136

We can achieve this using two methods

1.Change to Date & Time

Once the data has been imported in Tableau. Change the data type of the column to "Date & Time". Tableau data engine automatically understand the time format and change the decimal time to Actual time Refer this Image

2. Using Calculated Field "MAKETIME"

MAKETIME Requires three argument(hour, minute, second).Below code parse decimal number "3.1545" as 3 hrs, 9 min (0.15*60) and 16 sec (0.0045*3600)

MAKETIME(INT([DecimalTime]), int(INT(([DecimalTime]100)%100).6), int(INT(([DecimalTime]10000)%100).36))

Upvotes: 1

Related Questions