Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Problem with negative time

Hello everybody,

I'm having problems with this:

I have a table with 2 columns with entry times (Hora_ing) and out times (Hora_sal).

When i do the subtraction of Hora_sal and Hora_ing it works.

Captura de pantalla 2015-11-19 a las 4.56.37 p.m..png

But when the "truck" come to the place at 23:00:00 pm and lives at 00:00:01 am and after, my problem starts.

                                                     Hora_sal                                      Hora_ing

Captura de pantalla 2015-11-19 a las 4.49.26 p.m..png

the fields in blue are expression Hora_sal - Hora_ing and the times are negative and i need positives values, im trying to make a expression like:

if(Hora_sal-Hora_ingr < time#(00,'hh'), Hora_sal-Hora_ing = (Hora_sal-Hora_ing) + 24 ) and other stuffs but nothing works to me.

Regards,

Gerd Neumann

Tags (3)
1 Solution

Accepted Solutions

Re: Problem with negative time

Yes just do it like this:

Time(EndTimeStamp - StartTimeStamp, 'hh:mm:ss')

7 Replies
oknotsen
Honored Contributor III

Re: Problem with negative time

Do you still have the timestamps of which you based the times? If so, use those for your calculation.

May you live in interesting times!

Re: Problem with negative time

I think it would be better if use a TimeStamp (which include date field) to do this calculation because then it would know if it is the next day you are subtracting it for. Do you have a field which specifies date?

Not applicable

Re: Problem with negative time

the original Excel data, has a column with data and time, and i separate it into 2 columns.

You suggest to use the original column

Captura de pantalla 2015-11-19 a las 5.29.22 p.m..png

regards,

Gerd Neumann

Not applicable

Re: Problem with negative time

yes i have in other column, but i dont know how to use it

Re: Problem with negative time

Yes just do it like this:

Time(EndTimeStamp - StartTimeStamp, 'hh:mm:ss')

Not applicable

Re: Problem with negative time

Thank you very much!! it works for me!

Regards,

Gerd Neumann

Re: Problem with negative time

Awesome

Community Browser