Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

round() in LOAD

Hi all,

i am having a problem with an expression i am using in the LOAD script:

I have a field "Time spent (hours)". I have another field "Hours per Day".

If a wwant to calculate "Time spent (days)" i am doing the following in my LOAD:

round([Time spent (hours)] / [Hours per Day]).

I use round() because i want to have a full number.

In case of the following:

"Time spent (hours)" = 184

"Hours per Day" = 8

the result is 22 - although it should be 23.

if i do something like this:

sum(round([Time spent (hours)] / [Hours per Day]).)

i get an error wen executing the script.

Thanks for some help!

Regards,

K

5 Replies
swuehl
MVP
MVP

I do get 23. Can't reproduce your problem:

LOAD *,

    round([Time spent (hours)] / [Hours per Day]) as Test

INLINE [

Time spent (hours),Hours per Day

184,8

];

Anonymous
Not applicable
Author

yeah even i am getting the same as swuehl !

Anonymous
Not applicable
Author

Hi ,

from where are you loading  excel,qvd

are you using

round([Time spent (hours)] / [Hours per Day]) in ur expression in chart

in that case go to number check number format.

Thanks

anant

vivientexier
Partner - Creator II
Partner - Creator II

May be your field shows you "hours" but it may also contains "minutes" that QV doesn't show you according to your number format.

Test :

Round(Round([Time spent (hours)]) / Round([Hours per Day]))

er_mohit
Master II
Master II

hiii

b:

LOAD *,

round([TimeSpent hours]/[time spent per day])as full;

a:

LOAD * INLINE [

    TimeSpent hours, time spent per day

    184, 8

];

i got 23