How to create a new dimension in eazyBI to group Jira projects by prefix "Area - Service Level 1 - Jira Project" without multiple calculated members?

Hi everyone,

I have many Jira projects whose names follow a specific pattern: each project name is composed of three parts separated by hyphens. The first part represents the Area, the second part is the Service Level 1, and the third part is the actual Jira project name. For example, a project might be named “Finance - Reporting - Project X”, where “Finance” is the Area, “Reporting” is the Service Level 1, and “Project X” is the Jira project.

I want to group my projects based on the Service Level 1 portion into a custom dimension called “Service N1”. In other words, I want any project name that has the second part as “Reporting” to be mapped to “Reporting”, and similarly for other Service Level 1 values. This will allow me to measure metrics like Lead Time by these groupings without having to create dozens of separate calculated members.

I have tried using JavaScript in Advanced Settings with code like:

function() { if (!issue.fields.project) return null; var projectName = issue.fields.project.name; if (projectName.startsWith(“Finance - Reporting -”)) return “Reporting”; if (projectName.startsWith(“Marketing - Digital -”)) return “Digital Marketing”; return null; }

I have set the field to “Import as dimension”, but the new dimension often shows only (none) in my reports, even though I am sure the project names match the pattern exactly.

My questions are:

  1. Is my JavaScript syntax correct for extracting the Service Level 1 part from the project name?
  2. Should I perform a full re-import or is an incremental import sufficient after making these changes?
  3. Are there any other reasons why the dimension might remain empty despite the project names following the “Area - Service Level 1 - Jira Project” pattern?

Any tips or best practices to avoid creating many calculated members would be greatly appreciated.

Thanks in advance for your help!
EaziBi Noob

Hi @sebastian_calderon_r,

Welcome to the eazyBI community!

You have done a great job creating the script.
The only thing to change is to use the actual script of the function directly.
Otherwise, you are defining a function and not executing it.

You might remove the

function() { 

and closing curly braces from the end of the code.
That should do the trick.

You might as well only focus on positive outcomes as returning null is the same as not returning anything.

if (issue.fields.project) {
  var projectName = issue.fields.project.name;
  if (projectName.startsWith("Finance - Reporting -")) {return "Reporting"}
  if (projectName.startsWith("Marketing - Digital -")) {return "Digital Marketing"}
}

Regards,
Oskars / support@eazyBI.com