Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

If expressions

Hi,

I'm trying to write an expression to return a date when the OrderStatus is Cancelled.

If(OrderStatus ='Cancelled',SendingTime)

I thought the above would work, however it doesn't return any results.

I would appreciate any help with this issue.

Thanks,

Daniel

6 Replies
sunny_talwar

Are you sure this will be a single date? May be there are more than one dates, try concat to see if there are more than one dates here:

Concat(Distinct If(OrderStatus ='Cancelled', SendingTime))

danielnevitt
Creator
Creator
Author

Thanks Sunny, that works perfectly.

I was also trying to show the time difference between the order entry (SendingTime) and the cancellation.  Date format is dd/mm/yyyy hh:mm:ss.  Is this possible?

Thanks

Clever_Anjos
Employee
Employee

Maybe you have more than one try

Min({<OrderStatus ={'Cancelled'}>}SendingTime)

sunny_talwar

How would you want to show this for multiple entries?

danielnevitt
Creator
Creator
Author

The field linking each record is the ClOrdID.  If there are say three records and the last is cancelled, I would like to show the difference between the first = min(SendingTime) and cancelled date Concat(Distinct If(OrderStatus ='Cancelled', SendingTime))

Hope that makes sense?

Regards,

Daniel

sunny_talwar

I think cleveranjos‌'s solution make sense here:

Min(SendingTime) - Min({<OrderStatus = {'Cancelled'}>} SendingTime)