Skip to main content
Question

How to get time intervals by adding 30,60,90 days to EVENTIME, as when tried it always picks 30 days with case when statement. any suggestion would be great help.

  • January 20, 2022
  • 1 reply
  • 3 views

image

1 reply

joos.buijs
Level 10
Forum|alt.badge.img+2
  • Level 10
  • January 21, 2022

Hi @1460069841 ,

 

If I understand correctly you would like to aggregate the time difference between two occurrences to 0-30, 31-60, 61-90, 90+?

 

The reason why it only returns 30 days is because in essence you're doing this:

WHEN DAYS_BETWEEN(date1, date1+30) < 31 THEN '0-30'

where DATE1 is youre PU_FIRST thingy :)

This is by default always true. So I guess you need to change either one of the date fields.

 

Second, I do not understand why you add 30 days to a date, to then check the difference. Would'nt it be easier to not add the days?

 

Hope this helps!