Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max # of Days Open if conditions met

We have CaseManagers, and each CaseManager has Incidents assigned to them.  Each Incident has IncidentID and IncidentDate, which is the date the Incident was opened.  We can get the # of days each Incident is open by Today()-IncidentDate

For each CaseManager, I can get the maximum # of days an Incident is open by Max(Today()-IncidentDate)

Now we want to get the max # of days open of the oldest Incident for each CaseManager only is the Incident has "Active" status and only if IncidentDate is in 2016 to 2017 without having any filters such as IncidentYear or StateValue.  I can count the # of Incidents successfully by the below.

Working:

Count({<StateValue={"Active"}, IncidentDate={">=01/01/2016<=12/31/2017"}>}IncidentID)

I tried the below to get the Max # of days if these conditions are met:

Not Working:

IF({<StateValue={"Active"}, IncidentDate={">=01/01/2016<=12/31/2017"}>}Max(Today()-IncidentDate))

Please tell me how I can get this to work.  Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Not entirely sure, but may be this

Max({<StateValue={"Active"}, IncidentDate={">=01/01/2016<=12/31/2017"}>} Today()-IncidentDate)

View solution in original post

4 Replies
sunny_talwar

Not entirely sure, but may be this

Max({<StateValue={"Active"}, IncidentDate={">=01/01/2016<=12/31/2017"}>} Today()-IncidentDate)

lironbaram
Partner - Master III
Partner - Master III

hi

assuming you want the result for each manger you can use this

max({<StateValue={"Active"}, IncidentDate={">=01/01/2016<=12/31/2017"}>}aggr(Today()-IncidentDate,IncidentiD))

Not applicable
Author

Thank you so much!!!!!! This worked perfectly.

Not applicable
Author

This one returned no value for all CaseManagers.  Might have been something in the pivot set up I already had.  But the previous one worked for me.  Thanks for your reply.