Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulo_silva
Contributor II
Contributor II

Filter one field based on another

I have two tables, customer orders 

paulo_silva_0-1665683601027.png

and opened emails

paulo_silva_1-1665683646442.png

What I need is to find the last time a customer clicked an email before making a purchase. Something like this:

paulo_silva_2-1665683796010.png

How do I do this?

 

Labels (3)
1 Solution

Accepted Solutions
paulo_silva
Contributor II
Contributor II
Author

I managed to figure out what works here. You can do

max(if([Click Time]<[Order Time],[Click Time]))

View solution in original post

3 Replies
BrunPierre
Partner - Master
Partner - Master

One way is to use FirstSortedValue() in a chart expression like this:

=FirstSortedValue([Click Time],-[Click Time])

BrunPierre_2-1665698491520.png

paulo_silva
Contributor II
Contributor II
Author

Thanks for the reply, @BrunPierre !

That doesn't do it, since I might have multiple orders for one client. I need to find the last click time for every order. Putting it another way, I need to find the time of the last email the client clicked before the order. Any values here where [Click Time] are greater than [Order Time] are not correct. 

I'm trying 

=FirstSortedValue({$<[Click Time] = {"<=$([Order Time])"}>}[Click Time],-[Click Time])

But that's not doing it either.

paulo_silva
Contributor II
Contributor II
Author

I managed to figure out what works here. You can do

max(if([Click Time]<[Order Time],[Click Time]))