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: 
GeosoftRim
Contributor III
Contributor III

compare two dates

I want to understand the end date and start date of a transport in order to keep the transport with the start date which is before the end date. and calculate the time between the two thereafter.
Here is the graph with the negative durations that I want to delete them and the request that I typed and which did not work

if( (DATEFIN>DATEDEB), avg(Interval(DATEFIN-DATEDEB)))

GeosoftRim_0-1631181977232.png

Thanks 

7 Replies
sunny_talwar

Try this

Avg({<Agent = {"=DATEFIN-DATEDEB > 0"}>} Interval(DATEFIN-DATEDEB))
GeosoftRim
Contributor III
Contributor III
Author

thanks for your answer but it doesn't work for me 

sunny_talwar

Would you be able to provide more details as to what is the issue? Did my expression throw an error message?

GeosoftRim
Contributor III
Contributor III
Author

There is no syntax error, just negative durations always appear

sunny_talwar

The name of your dimension is Agent, right? Or is that a label? If it is a label, make sure to replace Agent with your actual dimension in the expression below

Avg({<Agent = {"=DATEFIN-DATEDEB > 0"}>} Interval(DATEFIN-DATEDEB))

GeosoftRim
Contributor III
Contributor III
Author

Yes , it's agent 

sunny_talwar

Would you be able to share an image where I can see the chart with the above expression? I can't think of a reason why this doesn't work, but may be I am missing something. Might help if you are able to share a sample where we can see this issue