Hi Mike,
Thanks for your question! You can definitely do that with Structure’s formulas.
This formula will be a little tricky because you divide aggregate values. But! I’d like to tell you first that with the upcoming Structure 4.2, it’s going to be much easier. However, for this example I would assume that you’re working on Structure 4.0 or 4.1.
First of all, you need to define a structure. For example, it could be a folder, under which a JQL inserter is placed for all issues you are interested in. I’m going to assume you know how to build a manual or automated structure — if you need help with that, let me know.
Then we’re going to define our formula. Here’s the brief instruction.
1. Add Formula column and write a formula, say: (total_bugs - customer_bugs) / total_bugs. (You don’t need to multiply by 100 — there’s “Percent” formatting option instead.)
2. You can see that these names will appear as red — you need to define what those variables are. For that you will need to add two more formula columns.
3. One column will have this formula: IF(project = "Project Name" AND (type = "Bug" OR type = "Story Defect"); 1) — this formula would produce “1” if it’s a bug that you are interested in, and “undefined” otherwise. Then, in the column settings, you need to select that you’d like to SUM this value. So for the top folder you’ll get the value of total_bugs.
4. Similarly, the other column would have a SUM of formula: IF(project = "Project Name" AND (type = "Bug" OR type = "Story Defect") AND external_reference; 1) — note that I didn’t compare external_reference with anything, it should work if there’s a value in the field. If you see one of those variables to be missing (red), click on it to pick the custom field.
5. Finally, in the overall formula, you need to define total_bugs and customer_bugs by selecting formulas from “Used in Columns” attributes.
6. Then you can remove the extra two columns.
Structure 4.2 will let you achieve the same result without two additional columns.
Hope this helps!
Kind regards,
Igor