How to get measured time in standard format from a number in Tableau

Typically in Tableau, when calculating time between two events, you would want to be given two times, a start time and an end time and do a DATEDIFF ('minutes', [Start Time], [End time]), to work out the actual minutes (time) in between (Again, I would typically advise to do this!).

However, recently I was working on a passion project where I was given time (in seconds), as a number format in Tableau, as a raw value - think my row level value was just 863 (14 mins 23 seconds).

For the purpose of the project, the time was required as how we typically perceive and use measured time. Therefore I did some playing and found a useful way to turn time unformatted into 'normal time'.

Before

The measure 'Moving Time' is currently in seconds and is not useful for what we want.

After

This is what we are looking for! See how time is how we would expect it now, as 17 minutes and 41 seconds.

The Initial Problem

First, I rather foolishly, started off by using the following calculated field:

This obviously didn't work, as I was being returned decimal numbers of a minutes hence;

What I was being returned was saying that essentially 41 seconds is 68% of 60 seconds (1 minute) - it is possible to show time like this in Tableau, however I would never recommend this. If someone picks up your workbook for the first time, or your are presenting to someone unfamiliar on the subject or approach, they'll probably think you're able to bend the realities of time...

The Process

So how did I do it? Well, its a little bit hacky and maybe technically cheating, but I got the desired outcome which was required.

First, start by making a calculated field, which we are going to be using for the y axis (rows).

Simply take [time in seconds]/60. This will give us the same value as mentioned before, which gives a % of minutes after the decimal - 'Moving times division' in the above graph. This is fine for the axis as we are going to leave it as 2 sigfigs/ 0 dps, so it will just represented minutes with an increment of a minute.

Then create another calculated field in order to turn your total time measurement value, in my case in seconds, into the standard time format:

You can copy the formula here:

STR(INT([Your Time period] / 60))

+":"

+RIGHT("0" + STR(INT([Your Time period] % 60)), 2)

Points to note

I've used /60, because I wanted to turn seconds into minutes so use a relevant time calculation/conversion to what you have.

This may not be the best practice way to go about calculating time in it's proper format - I would definitely use a datediff('minutes', [start date time], [end date time]), before this. However, if presented in the situation I was left in, with neither start date or end date, then this is a relatively faster way to achieve a same goal.

You can then go on to create graphs like the following:

Hope this was helpful.

Author:
Ted Evans
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab