Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pragyan
Contributor III
Contributor III

How to match selected date with each date in a column

@sunny_talwar Hi, I am new to Qlik sense and I am trying to match DateEntered field( date selected from date range picker ) with each date of another holiday_date column. Want to take the count only where holiday_date is in the same year as the date selected.

 

I tried something like :

aggr(sum(if(inyear([holiday_date ], '9/1/2021',0)=-1,1,0)),[customer_id],[customer_status='A'],[customer_system])

and gives expected result to me but in my case i should give selected date as base date here and that is not working as expected.

aggr(sum(if(inyear([holiday_date ], [DATE_ENTERED],0)=-1,1,0)),[customer_id],[customer_status='A'],[customer_system])

 

please suggest how to implement this requirement

 

3 Replies
Kushal_Chawda

@Pragyan  try below

aggr(sum(if(inyear([holiday_date ], max([DATE_ENTERED]),0)=-1,1,0)),[customer_id],[customer_status='A'],[customer_system])

or

aggr(sum(if(inyear([holiday_date ],max(total  [DATE_ENTERED]),0)=-1,1,0)),[customer_id],[customer_status='A'],[customer_system])

Pragyan
Contributor III
Contributor III
Author

@Kushal_Chawda Hi Kushal, Thanks for your reply I tried your solution but no luck. I am not sure what causing the issue but static date value is working perfectly fine in place of base date.

First I thought may be date format issue with my selected date but even the format are same for both the date fields I am not getting the expected output.

Would really appreciate any suggestions. 

sunny_talwar

Format of date doesn't matter in this case as long as the underlying values of both the fields are numeric. Have you checked Max[DATE_ENTERED]) expression in a KPI Object? Does it return anything? If it doesn't then may be DATE_ENTERED isn't read as a date field and you need to get that resolved. Once you do that, you can try the expressions provided by @Kushal_Chawda above.