Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
marcus_sommer

Try:

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

- Marcus

View solution in original post

5 Replies
Chanty4u
MVP
MVP

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

marcus_sommer

Try:

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

- Marcus

Not applicable
Author

This counts all records in the table.

Not applicable
Author

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

Thanks a lot Marcus!

Chanty4u
MVP
MVP

Hmmm