Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
zied_ahmed1
Specialist
Specialist

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
PrashantSangle

Hi,

try

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


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

11 Replies
pradosh_thakur
Master II
Master II

interval(field1-field2,'mm')

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

Learning never stops.
PrashantSangle

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.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
zied_ahmed1
Specialist
Specialist
Author

Hello ,

The answer is :

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

Thanks for all

zied_ahmed1
Specialist
Specialist
Author

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

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

pradosh_thakur
Master II
Master II

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

Learning never stops.
zied_ahmed1
Specialist
Specialist
Author

yes yes I delete the ss and i tryed

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


it doesn't work

PrashantSangle

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.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
zied_ahmed1
Specialist
Specialist
Author

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 '

PrashantSangle

Hi,

try

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


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂