5 Replies Latest reply: Jan 6, 2016 7:45 AM by Chanty 4u

# Count with date difference as condition

Hello!

Here is my sample data:

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

• ###### Re: Count with date difference as condition

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

• ###### Re: Count with date difference as condition

This counts all records in the table.

• ###### Re: Count with date difference as condition

Hmmm

• ###### Re: Count with date difference as condition

Try:

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

- Marcus

• ###### Re: Count with date difference as condition

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

Thanks a lot Marcus!