Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count the days between two dates

Hello,

Can you tell me how can I count the days between two dates ?

I want to create a chart with opened cases and I have to create some dimensions in days.

<7 days 14-14 days 14-30 days 30-90 days.

print.png

Similar to this chart.

And I don't have any ideas how to do this. Can you give me a clue ?

Thanks!

11 Replies
Not applicable
Author

Thanks you so much!

mjtaft2017
Partner - Creator
Partner - Creator

If you can put this in the load script it would be more efficient than putting this expression in as your dimension in the chart.  I'm new to Sense also so I am not sure if you can use the Interval function in your syntax if you put this "IF" in the load script, but you can try it as

@Sasidhar Parupudi mentioned in his post.  His response is correct - I just had to do something similar in QlikView and it was mentioned to put it in the load script if possible for better performance.



if (Interval(DateField2 - DateField1,'D')<7,'<7 days',

  if(Interval(DateField2 - DateField1,'D')>7 and Interval(DateField2 - DateField1,'D')<14,'7-14 days',

  if(Interval(DateField2 - DateField1,'D')>14 and Interval(DateField2 - DateField1,'D')<30,'14-30 days',

  if(Interval(DateField2 - DateField1,'D')>30 and Interval(DateField2 - DateField1,'D')<90,'30-90 days','>90 Days')))) AS Interval