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

Average calculated as days instead of hours

Still fairly new to qlik but, for some reason qlik is calculating the average of a column as days instead of Hours. My data is formatted HH:MM:SS. Anyone know how to correct this ? On a side not I do have nulls in that same column (time completed). What is the easiest way to exclude them as they are skewing my results. Using the option to exclude nulls does not seem to be working like it has before.

Thanks,

7 Replies
Not applicable
Author

Can you post a sample qvw?  What type of chart is in question and what expression are you using?

Not applicable
Author

Is it just a strait table chart that I am currently using at this time, but it will eventually move to a gauge chart.

ChiragPradhan
Creator II
Creator II

Hi

Chart Properties -> Number -> Set Number Format Settings to Time.

Chart Properties -> Dimension -> Suppress When Values is Null

HTH

Chirag.

Not applicable
Author

Chirag,

The first part will work, but I am not planning to use a dimension, just a expression in this case

Not applicable
Author

Assuming you're loading your Time field as 'HH:MM:SS' and not just strings I believe =time(avg([YourTimeField]), 'HH:MM:SS') will get you what you need.

Not applicable
Author

That string seems to work, but because of the nulls it is taking them into calculation as well and making the average smaller than it should be. I have tried adding the following to my load script to exclude the nulls but that does not seem to be working either.

NULLASVALUE;

Set NullValue = '';

Not applicable
Author

Try the following...   =time(avg({<[YourTimeField]={'*'}>}[YourTimeField], 'HH:MM:SS')  I think that will only average the times where there is some value, hence the *.