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: 
Not applicable

Please help me with the if statement below

How can I write this in Qlikview.Please help me.

IIf(RTL_TERMS.TRMN_DT Is Null AND DATEDIFF("YYYY",QRYALL_RTL_WRK_ENDPOP.HIR_DT,QRYALL_RTL_WRK_ENDPOP.AS_OF_DT)*12+DATEDIFF("M",QRYALL_RTL_WRK_ENDPOP.HIR_DT,QRYALL_RTL_WRK_ENDPOP.AS_OF_DT) BETWEEN  0 AND 6, "011401",

IIf(RTL_TERMS.TRMN_DT Is Not Null AND  DATEDIFF("YYYY",QRYALL_RTL_WRK_ENDPOP.HIR_DT,RTL_TERMS.TRMN_DT)*12+DATEDIFF("M",QRYALL_RTL_WRK_ENDPOP.HIR_DT,RTL_TERMS.TRMN_DT) BETWEEN  0 AND 6, "011401", "None"))) as Tenure

Thanks in advance.

1 Reply
whiteline
Master II
Master II

Hi.

Maybe like this:

If(not isnull(RTL_TERMS.TRMN_DT) and rangemax(12*(year(QRYALL_RTL_WRK_ENDPOP.HIR_DT)-year(RTL_TERMS.TRMN_DT)) + month(QRYALL_RTL_WRK_ENDPOP.HIR_DT)-month(RTL_TERMS.TRMN_DT),0)>=6, '022401', 'None') as Tenure

Or

If(not isnull(RTL_TERMS.TRMN_DT) and addmonths(QRYALL_RTL_WRK_ENDPOP.HIR_DT, -6) <=  RTL_TERMS.TRMN_DT , '022401', 'None') as Tenure