Qlik Community

Qlik Sense Deployment & Management

Discussion board where members learn more about Qlik Sense Installation, Deployment and Management.

zied_ahmed1
Contributor III

Difference between two dates

Hello ,

I have two fields and i would like to have the difference between them :

The two fileds are timestamp

and I need to have condition the difference is > 30 minutes

Thanks

Difference.png

omarbensalem

1 Solution

Accepted Solutions

Re: Difference between two dates

Hi,

try

if(num(num#(interval(Field2-Field1,'mm'),'###'))>30,'Hello', 'No')


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
11 Replies
pradosh_thakur
Honored Contributor II

Re: Difference between two dates

interval(field1-field2,'mm')

use this in any condition like if (interval(field1-field2,'mm') >30 , eepression1, expression2)

Learning never stops.

Re: Difference between two dates

To find difference between two timestamp use

interval()

try like

interval(dateField1-dateField2,'mm')

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
zied_ahmed1
Contributor III

Re: Difference between two dates

Hello ,

The answer is :

interval(Filed 2 - Field 1,'mm:ss')

Thanks for all

zied_ahmed1
Contributor III

Re: Difference between two dates

I use this for the condition but it doesn't work :

if (interval(field1-field2,'mm') >30 , eepression1, expression2)

pradosh_thakur
Honored Contributor II

Re: Difference between two dates

where exactly are you using this? and if you need only minutes why using mm:ss?

Learning never stops.
zied_ahmed1
Contributor III

Re: Difference between two dates

yes yes I delete the ss and i tryed

if ( interval(field1-field2,'mm') >30 , eepression1, expression2)


it doesn't work

Re: Difference between two dates

Hi,

use if(num(num#( interval(field1-field2,'mm') >30)),epression1, expression2)


interval() is formatting function it wont convert actual data.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
zied_ahmed1
Contributor III

Re: Difference between two dates

Hello Preshant,

I used this :

if(num(num#( interval(Field2-Field1,'mm') >30)),'Hello', 'No') and this is the result :

result.PNG

the value is 189 > 30 and it display 'No '

Re: Difference between two dates

Hi,

try

if(num(num#(interval(Field2-Field1,'mm'),'###'))>30,'Hello', 'No')


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Community Browser