Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sunflower_00
Contributor II
Contributor II

Interval between two timestamps

Hi 

I have this calculation:

Interval(Date1 - Date2, 'YYYY-MM-DD hh:mm:ss') 

But it returned the same timestamp for all the the rows. 

How do I resolve this?

Labels (1)
3 Replies
cristianj23a
Partner - Creator III
Partner - Creator III

Hi, try formatting your date fields and then the interval.

Interval(Date(Date1,'YYYY-MM-DD hh:mm:ss') - Date(Date2,'YYYY-MM-DD hh:mm:ss')) as Interval,

 

cristianjmr_0-1690400782967.png

 

Regarts.

 

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.
daturpin
Partner - Creator II
Partner - Creator II

When you added the column, did you enter it as a measure?

 

Try deleting that column, then add it as a dimension, use the same expression as before.

cristianj23a
Partner - Creator III
Partner - Creator III

esa columna se convirtió en una dimensión, porque se calculó en el script.
El cálculo fue la resta de dos fechas y te da el resultado en horas, aunque el AM y PM ya no es necesario porque no indica nada en el campo "intervalo" creado.

cristianjmr_0-1690403677567.png

 

Ahora si quieres calcular esa columna en las medidas, puedes hacerlo en el formato que quieras.

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.