I've decided to take a different approach to the question I posted previously that I think will give me the result I want. After looking at it for awhile I realized my data has no 0 values so of course it would be impossible for me to find the max number of consecutive zero days. Instead I've wrote an algorithm in pseudo-code that I think should work but am having a hard time converting it to qlik syntax. This is all to help me find the max days in the current year without an incident.
1. Create variable dummyvariable1 and set equal to zero.
2. Create variable dummyvariable2 and set equal to zero.
3. Find first date with value. I made something that works for this:
However, how can I make this default to data only for the max year. When I deselect my 2018 filter it changes that data and looks for the the max days of no incidence over the past 4 years. I would like the number to stay as the 2018 number even when I deselect the filter. I tried a couple if statements but they just gave me null. Thanks!