Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
snehamahaveer
Creator
Creator

How to create a input box that inputs days and then convert it to hours?

Hi,

I have two input box. 1- for number of days worked , 2 - for the number of days in field (for sales people)

The data entered is in number format and I want to multiply it into 9.5 and change it to hours.

Any idea of how this can be achieved. ?

Capture.JPG

1 Solution

Accepted Solutions
rubenmarin

ok, I didn't understand it right, then it should be:

=Interval(vWorkingDays*9.5/24, 'hh')

or

=Interval(vWorkingDays*9.5/24, 'hh:mm') // If you want also minutes

View solution in original post

8 Replies
rubenmarin

Hi shena, in example, if the variable is named vWorkingDays you can use this expression:

=vWorkingDays*9.5*24

sunny_talwar

If create another variable for it. For example if vVar is the variable which is linked to your current inputbox, create

vVar2 = vVar * 9.5

I might not have understood your requirement well enough, but seems like this is what you wanted.

HTH

Best,

Sunny

snehamahaveer
Creator
Creator
Author


Thanks Ruben and Sunny,

I did use the logic mentioned. But again,

if I choose the number of working days to be 18 and multiply it with 9.5 = 171(this is number and not hours) how to change 171 to 171:00 ?

Is there a way to change it? I tried - Date(vWorkingdays*9.5, 'hh:mm') but it did not convert to the right value.

vardhancse
Specialist III
Specialist III

Hi,

Create 2 different variables:

one variable(Var_1): Working days input box

second variable(Var_2): while creating enter the expression like Var1*905

Now create one more input box with var_2

Now based on the Working days the infield days will change

rubenmarin

ok, I didn't understand it right, then it should be:

=Interval(vWorkingDays*9.5/24, 'hh')

or

=Interval(vWorkingDays*9.5/24, 'hh:mm') // If you want also minutes

sunny_talwar

Use Interval Function

=Interval(vWorkingDays * 9.5/24, 'hh:mm')

snehamahaveer
Creator
Creator
Author

Awesome, it worked. Could you please explain why we divide the value by 24? is it to denote the number of hours in a day?

rubenmarin

Yes, dates and times are really a number and the base unit is 'day', so:

1 = 1 day

1/24 = 1 hour

1/1440 = 1 minute