Quick Fix: “`
…AND status changed to "X" before startOfYear(-7) AND NOT status CHANGED TO "X" AFTER startOfYear(-6)
The Problem:
You want to find issues that changed status more than 7 days ago, but only the last status change. You have tried using the following JQL:
status in ("X") AND status changed to "X" before startOfDay(-7)
However, this JQL does not consider the condition that a status can be changed multiple times, and you only want to find the last change. So, this JQL returns issues that changed status yesterday, even if the first change was 1 month ago.
The Solutions:
Solution 1:
The provided JQL:
status in ("X") AND status changed to "X" before startOfDay(-7)
suffers from a limitation in that it doesn’t differentiate between multiple status changes. To address this, we can employ a logical approach:
*status changed to "X" before startOfDay(-7) AND NOT status CHANGED TO "X" AFTER startOfDay(-6)
This refined JQL will accurately capture issues that underwent a status change to "X" more than 7 days ago and have not experienced any subsequent status changes to "X" since then.