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

Using INTERVAL function with IF condition

I have three dates: Supreme Case date, Appeal Case date, and Primary Case date. I want to create a logic that processes these dates as follows:

  1. If the Supreme Case date is available, skip the other dates and calculate the interval days by subtracting the Case Filing date from the Supreme Case date.
  2. If the Supreme Case date is not available but the Appeal Case date is, skip the Primary Case date and calculate the interval days by subtracting the Case Filing date from the Appeal Case date.
  3. If only the Primary Case date is available, calculate the interval days by subtracting the Case Filing date from the Primary Case date.

I implement this logic

 

if(Len(Trim([Supreme case No])) = 1
and Len(Trim([Appeal No])) = 1 or Len(Trim([Appeal No])) = 0
and Len(Trim(Primary_Decree_No)) = 1 or Len(Trim(Primary_Decree_No)) = 0,
Num(Interval(Supreme_Court_Date - Filling_Date,'DD')),Num(Interval(Supreme_Court_Date - Filling_Date,'DD')))

Labels (3)
1 Reply
marcus_sommer

It could be simplified with alt() which returned the first numerical value. This may look like:

interval(alt(Date1, Date2, Date3) - Date4)