# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## How to show difference between two date fields

Hi,

I have a two fields NR, IRB.

1. NR>30 DAYS to IRB Date ,   required resultrocessing, Late Payment.
2. NR<30 DAYS to IRB Date ,   required result: on time payment.
3. when  to IRB Date is value: '-' ,    required result: Processing.
4. NR we will calculate based on system date required, entered more than system date required result: entered wrong date.

note: I required all these expressions in set analysis only.

1. I'm tried for this :

If([IRB] = '-', 'Processing',

If([IRB]- [PaymentDate NR] < 30, 'On Time Payment', 'Late Payment'))

** i want to convert if() into set analysis**

NRIRB
10-Jan-1713-Jan-17
26-Jan-1702-Feb-17
31-jan-1710-feb-17
20-feb-175-apr-17
5-feb-17-
10-mar-175-jun-17
5-apr-17-

Ravi.

8 Replies
Valued Contributor

## Re: How to show difference between two date fields

i think

if (IRB-NR>30,Late Payment,time payment)

Contributor

## Re: How to show difference between two date fields

Hi,

I want to satisfy all 4 conditions in one expression.

Valued Contributor III

## Re: How to show difference between two date fields

Check this out. !

Contributor

## Re: How to show difference between two date fields

Hi Required all those expressions in Set analysis only.

Valued Contributor III

## Re: How to show difference between two date fields

Use NR and IRB as dimensions.

Measure:

=If((if(IRB = '-',0, NUm(Date#(IRB,'DD-MMM-YYYY')))- NUm(Date#(NR,'DD-MMM-YYYY')))>30, 'Processing,Late Payment',

If((if(IRB = '-',0, NUm(Date#(IRB,'DD-MMM-YYYY')))- NUm(Date#(NR,'DD-MMM-YYYY')))>0 and

(if(IRB = '-',0, NUm(Date#(IRB,'DD-MMM-YYYY')))- NUm(Date#(NR,'DD-MMM-YYYY')))< 30 , 'on time payment',

If((if(IRB = '-',0, NUm(Date#(IRB,'DD-MMM-YYYY')))- NUm(Date#(NR,'DD-MMM-YYYY')))<0, 'Processing')))

check attached.

Contributor

## Re: How to show difference between two date fields

Hi,

I required all if()expressions into set analysis only.

Thanks,

Ravi.

Valued Contributor III

## Re: How to show difference between two date fields

Just wondering if you want the result or set expression.

If you want to write this into set expression then you have to have all the text values pre-defined.

Valued Contributor III

## Re: How to show difference between two date fields

And set expression is mainly for defining sets,and its not used to pre define text values like what you do with if() and pick() expressions.