Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
pgloc2020
Creator
Creator

Display filtered data based on the difference of 2 dates

Hello All,

I have  2 date fields and the requirement is to first calculate the difference of the days and then display only data that has 45 days difference.

This is a straight table with the column names - Case ID and the 2 date columns are - Email_Sent_Date and Case_Closing_Date

I added one more column  and used the following expression in the measure -

Interval(Case_Closing_Date -Email_Sent_Date,'d')

Above formula gives me the difference correctly in days but I am trying to rename this column as Date Difference and also I wanted to display only those Case ID 's data where the date difference is = 45 days only

Please help me how  I can achieve that.

Thank you .

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda

@pgloc2020  also, you need to put expression as measure, if you are using it in dimension, use below. then this option will work

=if(Case_Closing_Date -Email_Sent_Date <=45, Case_Closing_Date -Email_Sent_Date ,null())

View solution in original post

5 Replies
Kushal_Chawda

@pgloc2020  Intreval is just formatting function, which is actually not giving values in days. SO if you further want to compare with difference , you need to convert it to get actual day number, hence I have used floor over date to get days difference

=if(floor(Case_Closing_Date) -floor(Email_Sent_Date ) <=45, floor(Case_Closing_Date) -floor(Email_Sent_Date ),0)

 

if your Date doesn't contain time factor, you can simply use below to get days difference

=if(Case_Closing_Date -Email_Sent_Date <=45, Case_Closing_Date -Email_Sent_Date ,0)

uncheck suppress zero values option

pgloc2020
Creator
Creator
Author

Thank you so much for the quick reply. I used the expression you mentioned but even by unchecking suppress zero values option, I am getting 0 and 45. Please see the below SS-

pgloc2020_0-1682348286342.png

 

Kushal_Chawda

@pgloc2020  it is suppress null value.. for suppress zero values, go to property ->Add-Ons

Kushal_Chawda

@pgloc2020  also, you need to put expression as measure, if you are using it in dimension, use below. then this option will work

=if(Case_Closing_Date -Email_Sent_Date <=45, Case_Closing_Date -Email_Sent_Date ,null())

pgloc2020
Creator
Creator
Author

Thank you @Kushal_Chawda . This works.

pgloc2020_0-1682349680922.png