Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to calculate average time for time values in mm:ss ?

i have a column 'baggage time' having values like,

01:23

06:16

01:50

00:28

etc.

i need to plot average baggage time on y axis of a chart, any idea how to do it ?

thanks.

17 Replies
alexandros17
Partner - Champion III
Partner - Champion III

You could transform your time into a numerical rapresentation so mm*60 + ss so for example

06:16 become 6*60 + 16 -> 376

Then you have only to do Avg(myNewField) to have numerical representation.

The result can be divided by 60 to find minutes num and the remainder are the seconds

It's an idea ...hope tjis helps

Not applicable
Author

yes i converted mm:ss format into seconds i.e ss in a new column but avg function for that column is giving me strange values.

see the y axis of chart in attached image

MarcoWedel

Time(Avg([baggage time])

Not applicable
Author

its not working

Not applicable
Author

i have converted all column values in seconds, so the expression avg([baggage time in seconds]) is giving me wrong values on y axis

jonathandienst
Partner - Champion III
Partner - Champion III

Ajinkya Pujari wrote:

its not working

Well if you want useful input, you'll have to give us more than that...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MarcoWedel

seems to work for me

QlikCommunity_Thread_169779_Pic1.JPG

QlikCommunity_Thread_169779_Pic2.JPG

QlikCommunity_Thread_169779_Pic3.JPG

tabBagProcTime:

LOAD RecNo() as ID,

    Ceil(Rand()*52) as Week,

    Pick(Ceil(Rand()*3),'ASIG','DNATA','SATS') as HANDLERS,

    Time(Rand()) as [baggage time]

AutoGenerate 1000;

hope this helps

regards

Marco

Not applicable
Author

@Marco Wedel Here is the sample data, in the chart 'Average baggage time' i am getting strange values.

Not applicable
Author

Helllo Ajinkya,

Try using the Time#() and specify the format string as 'mm:ss' on your field, i.e.,baggage time.

And then try finding the average.. I guess you will get the correct result. To verify the average time you can also use this link--> Time Calculator

I have also attached my sample qvw.

Thanks