Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Emma1
Contributor III
Contributor III

If date is greater than the other..

I have written this script to create one column with most recent update

If(Oppty.Date >= Contact.Date, [Oppty.Date], [Contact.Date])
as LAST_ACTION_DATE

Now some values of [Oppty.Date] and [Contact.Date] are null.

I want to introduce another line of code to take the field with a date if the other is null. Please help

2 Solutions

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

not 100% sure on your requirements but taking a guess trying something like below

if(IsNull(Oppty.Date),Contact.Date,

if(IsNull(Contact.Date),Oppty.Date,

If(Oppty.Date >= Contact.Date, [Oppty.Date], [Contact.Date]) // if both not null

))
as LAST_ACTION_DATE

View solution in original post

sunny_talwar

You can give this a shot as well

Date(RangeMax(Oppty.Date, Contact.Date)) as LAST_ACTION_DATE

View solution in original post

3 Replies
dplr-rn
Partner - Master III
Partner - Master III

not 100% sure on your requirements but taking a guess trying something like below

if(IsNull(Oppty.Date),Contact.Date,

if(IsNull(Contact.Date),Oppty.Date,

If(Oppty.Date >= Contact.Date, [Oppty.Date], [Contact.Date]) // if both not null

))
as LAST_ACTION_DATE

sunny_talwar

You can give this a shot as well

Date(RangeMax(Oppty.Date, Contact.Date)) as LAST_ACTION_DATE
Emma1
Contributor III
Contributor III
Author

What of the case where both are null? How do we include it in the code?