Shows a risk matrix on your Confluence page based on a Jira filter
A risk matrix is a table showing the distribution of risks based on their impact and likelihood (probability).
Such a table is organized in rows representing the likelihood, and columns representing the impact (or vice versa). Each cell represents a combination of both and is colored green, yellow or red depending on the severity of its combination. A risk with a heavy impact and a high likelihood is red, low and low leads to green, the in-betweens are yellow.
In order to get the typical coloring pattern as shown on the left, either the rows or columns need to be ordered ascending while the other needs to be ordered descending.
This macro uses specific Jira custom fields and values in it. You can adjust those to your environment and use case but then you need to adjust the macro accordingly. For the purpose of this documentation I am assuming that the following pre-conditions are met.
- 1.This macro accesses Jira issues. It is assumed that you have a Jira instance linked to your Confluence instance.
- 2.It is assumed that you have created an issue type “Risk” in Jira and a project that uses it.
- 3.It is assumed that you have created a custom field “Impact” in Jira as a single-select list with the following values:
- 1 – Very low
- 2 – Low
- 3 – Medium
- 4 – High
- 5 – Very high
- 4.It is assumed that you have created a custom field “Likelihood” in Jira as a single-select list with the following values:
- 1 – Rare (<10%)
- 2 – Unlikely (11-30%)
- 3 – Possible (31-50%)
- 4 – Likely (51-80%)
- 5 – Almost certain (81-99%)
The Risk Matrix macro runs a JQL in Jira, to be precise, it runs a different filter for each cell in the table. Let’s look at the one for the upper left cell from the screenshot above:
project in MYPROJ and issuetype = "Risk" and Likelihood = "5 - Almost certain (81-99%)" and Impact = "1 - Very low"
As you probably already assumed, you need one query for each combination of Impact and Likelihood. I suggest you run those filters in Jira first to make sure they return a useful result.
Try to add such a query on a Confluence page using the Jira macro. Make sure to drop down the Display options at the bottom and select “Total issue count”. That will output just the number of issues that this query returns.
With that, you can already create a static hard-coded risk table on a Confluence page. Create the table and add each Jira macro in its corresponding cell.
It is very probable that there are several projects in your Jira instance using the Risk issue type and all those project managers would like to show a risk matrix in Confluence without going through all the manual table and Jira macro stuff. If you are hosting a Server or Data Center version of Confluence yourself, a user macro is the perfect solution.
A user macro allows the user to conveniently enter custom values into a macro dialog and the macro does all the work for you.
The macro in this example allows to enter:
- project key/s for the queries
- issue type for the queries
- font size
- Likelihood string values (assuming five values)
- Impact string values (assuming five values)
The macro also adds a little style sheet providing a more saturated red, yellow and green for the cell backgrounds.
I will not go into the details about how to generate Confluence user macros in general. You can find a good documentation here: