How to compare and build a chart with 2 date fields

For example, there are 2 date custom fields Targeted Date and Actual Date.

To compare these 2 dates, you can use ScriptRunner’s dateCompare:

issueFunction in dateCompare("", "Actual Date > Targeted Date")
mchart date compare jql.png

In the gadget, select Targeted Date as the Date Field to see the number of issues that missed the targeted date:

mchart gadget missed targeted date.png

This can also be done using the resolution date and due date, to show number of issues that were resolved later than their due date:

issueFunction in dateCompare("", "resolutionDate > dueDate")