Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Count with date difference as condition

Hello!

Here is my sample data:

Capture.PNG

I want to count the records that fits the condition: Date B - Date A <= 180

I tried a number of expressions but none work:

  • count(distinct if((date([Date B])-date([Date A])) <= $(180),[ID]) >>  nothing is displayed?
  • count(distinct {$<[Date B] = { <=$(=<date([Date A]+180)) } >} [ID]) >>  counts all records (result = 20)
  • count(distinct {$<[Date B] = {" <=$(=<date([Date A]+180)) "} >} [02_Full_name]) >>  result = 0

Please help!

1 Solution

Accepted Solutions

Re: Count with date difference as condition

Try:

count(if([Date B]-[Date A] <= 180, [ID])

- Marcus

5 Replies
sureshqv
Esteemed Contributor III

Re: Count with date difference as condition

count(distinct {$<date[Date B] = { <=$(=<date([Date A]+180)) } >} [ID]) >>

Re: Count with date difference as condition

Try:

count(if([Date B]-[Date A] <= 180, [ID])

- Marcus

Not applicable

Re: Count with date difference as condition

This counts all records in the table.

Not applicable

Re: Count with date difference as condition

This works perfectly! How come I didn't think of this...

Thanks a lot Marcus!

sureshqv
Esteemed Contributor III

Re: Count with date difference as condition

Hmmm