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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jamelmessaoud
Creator II
Creator II

Previous function

Hi guys,

When using the previous function can you by any chance specify a column number?

I have some data like this

           

dateTimevehiclepostcodecollectioncollection_regioncollection_postcodedeliverydelivery_regiondelivery_postcodelast_stop_start_postcodesort_order
05/03/201816:04K66BS1      No  Yes BS1   BS1   1
05/03/201823:59K66NP20     End End NP20     2
06/03/201806:58K66NP20     StartStartNP20     3
06/03/201807:03K66NP44     Yes NP44  NP44  No  4
06/03/201807:06K66NP44     Yes NP44  NP44  No  4
06/03/201807:46K66NP44     Yes NP44  NP44  No  4
06/03/201808:01K66NP44     Yes NP44  NP44  No  4
06/03/201808:02K66NP44     Yes NP44  NP44  No  4
06/03/201808:04K66NP44     Yes NP44  NP44  No  4
06/03/201808:06K66NP44     Yes NP44  NP44  No  4
06/03/201808:07K66NP44     Yes NP44  NP44  No  4
06/03/201808:09K66NP44     Yes NP44  NP44  No  4
06/03/201808:10K66NP44     Yes NP44  NP44  No  4
06/03/201811:30K66BH12     No  Yes BH12  BH12  4
06/03/201811:33K66BH12     No  Yes BH12  BH12  4
06/03/201811:34K66BH12     No  Yes BH12  BH12  4
06/03/201812:28K66BH12     No  Yes BH12  BH12  4
06/03/201812:31K66BH12     No  Yes BH12  BH12  4
06/03/201812:32K66BH12     No  Yes BH12  BH12  4

I am trying to write an if statement which is something like:

IF(delivery_region = postcode and Previous(delivery = 'Start') and the delivery column = 'Yes' on the sort order 1 column),Previous(postcode)


So basically I am trying to extract NP20 from my data but only when the first column is a delivery.  If delivery was "No" I would not want it.


Hope this makes sense?


Thanks



4 Replies
YoussefBelloum
Champion
Champion

Hi,

I don't really understand what you're trying to do but Previous() is a script function.

look at above() and below() instead

shiveshsingh
Master
Master

Can you a bit more clear about the requirement?

jamelmessaoud
Creator II
Creator II
Author

This is basically off the back of this topic which i raised here - Delivery/Collection fields

This was answered perfectly but I would like to take it a step further now by trying to create an if statement as mentioned in my original post.

Thanks

jamelmessaoud
Creator II
Creator II
Author

I've figured out a way around this now, so this thread can be closed/deleted.

Thanks