Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Data format unknown seconds with decimals

Hi there,

I am developing Google Analytics into QlikView by using the Data Feed Query Explorer.

There is a dimension I use called Average Time On Site. This field is returned as a string in seconds, but QV doesn't recognize that as seconds or a number.

In the attachment you can find the result per date. I don't know how to change this format into a number so I can use it in an expression. Any thoughts?

Kind regards,

Henco

1 Solution

Accepted Solutions
swuehl
MVP
MVP

What is your standard decimal point separator set to? Or how do you parse in the number while loading in?

Have you tried

LOAD

Date,

num#(AvgTimeOnSite, '#.#' ,'.',',') as AvgTimeOnSite

from ...

so explicitely stating the decimal point separator.

Hope this helps,

Stefan

View solution in original post

8 Replies
Anonymous
Not applicable
Author

I forgot the attachment. Find it below.

AvgTimeOnSite.jpg

swuehl
MVP
MVP

What is your standard decimal point separator set to? Or how do you parse in the number while loading in?

Have you tried

LOAD

Date,

num#(AvgTimeOnSite, '#.#' ,'.',',') as AvgTimeOnSite

from ...

so explicitely stating the decimal point separator.

Hope this helps,

Stefan

Anonymous
Not applicable
Author

Thanks a lot for your help Stefan, thats it.

Kind regards,

Henco

Anonymous
Not applicable
Author

Could you also tell me how to put this in HH:MM:SS format?

It doesn't work when I choose Interval or Time on the Number tab.

Henco

swuehl
MVP
MVP

Hi,

try

...

interval(num#(AvgTimeOnSite,'.',',')/(24*60*60),'hh:mm:ss')  as AvgTimeOnSiteFormatted

...

Anonymous
Not applicable
Author

Thanks again, you helped me out.

Cheers,

Henco

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Computing the time with division may be accurate enough for your app, but it can cause problems. The more accurate QV way to convert seconds into an interval is:

interval#(secondsValue, 's')

If you do it with division, your intervals may not match up with intervals from QV functions or data from other sources like DB tables. This can become a problem when for example you assign your time values to buckets.

For more, see

http://qlikviewnotes.blogspot.com/2011/10/correct-time-arithmetic.html

-Rob

Anonymous
Not applicable
Author

Hi all,

Maybe one of you knows an answer to my question? I hope so.

See http://community.qlik.com/message/199424#199424

Regards,

Henco