Forum Discussion

Mike282's avatar
Mike282
Icon for Helper III rankHelper III
6 years ago

Expanding out Jira Issue Descriptions.

So I've been trying to hook Power BI up with Jira and I haven't used the out of the box Content Pack . Below is the full M script code for the transformation steps I've taken. Note the "column1.field.description" field/column that I had to expand out twice.

 

let
    Source = Json.Document(Web.Contents("https://companyname.atlassian.net/rest/api/3/search?jql=project in ('TEST')", [Headers=[Authorization="Basic " & Credentials]])),
    issues = Source[issues],
    #"Converted to Table" = Table.FromList(issues, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"expand", "id", "self", "key", "fields"}, {"Column1.expand", "Column1.id", "Column1.self", "Column1.key", "Column1.fields"}),
    #"Expanded Column1.fields" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.fields", {"statuscategorychangedate", "issuetype", "parent", "timespent", "project", "fixVersions", "resolution", "resolutiondate", "watches", "lastViewed", "created", "priority", "timeestimate", "versions", "issuelinks", "assignee", "updated", "status", "components", "description", "summary", "creator", "duedate", "progress", "votes"}, {"Column1.fields.statuscategorychangedate", "Column1.fields.issuetype", "Column1.fields.parent", "Column1.fields.timespent", "Column1.fields.project", "Column1.fields.fixVersions", "Column1.fields.resolution", "Column1.fields.resolutiondate", "Column1.fields.watches", "Column1.fields.lastViewed", "Column1.fields.created", "Column1.fields.priority", "Column1.fields.timeestimate", "Column1.fields.versions", "Column1.fields.issuelinks", "Column1.fields.assignee", "Column1.fields.updated", "Column1.fields.status", "Column1.fields.components", "Column1.fields.description", "Column1.fields.summary", "Column1.fields.creator", "Column1.fields.duedate", "Column1.fields.progress", "Column1.fields.votes"}),
    #"Expanded Column1.fields.description" = Table.ExpandRecordColumn(#"Expanded Column1.fields", "Column1.fields.description", {"content"}, {"Column1.fields.description.content"}),
    #"Expanded Column1.fields.status" = Table.ExpandRecordColumn(#"Expanded Column1.fields.description", "Column1.fields.status", {"name"}, {"Column1.fields.status.name"}),
    #"Expanded Column1.fields.priority" = Table.ExpandRecordColumn(#"Expanded Column1.fields.status", "Column1.fields.priority", {"name"}, {"Column1.fields.priority.name"}),
    #"Expanded Column1.fields.project" = Table.ExpandRecordColumn(#"Expanded Column1.fields.priority", "Column1.fields.project", {"name"}, {"Column1.fields.project.name"}),
    #"Expanded Column1.fields.issuetype" = Table.ExpandRecordColumn(#"Expanded Column1.fields.project", "Column1.fields.issuetype", {"name"}, {"Column1.fields.issuetype.name"}),
    #"Expanded Column1.fields.progress" = Table.ExpandRecordColumn(#"Expanded Column1.fields.issuetype", "Column1.fields.progress", {"progress", "total"}, {"Column1.fields.progress.progress", "Column1.fields.progress.total"}),
    #"Expanded Column1.fields.creator" = Table.ExpandRecordColumn(#"Expanded Column1.fields.progress", "Column1.fields.creator", {"name"}, {"Column1.fields.creator.name"}),
    #"Expanded Column1.fields.description.content" = Table.ExpandListColumn(#"Expanded Column1.fields.creator", "Column1.fields.description.content"),
    #"Expanded Column1.fields.description.content1" = Table.ExpandRecordColumn(#"Expanded Column1.fields.description.content", "Column1.fields.description.content", {"type", "content"}, {"Column1.fields.description.content.type", "Column1.fields.description.content.content"}),
    #"Expanded Column1.fields.description.content.content" = Table.ExpandListColumn(#"Expanded Column1.fields.description.content1", "Column1.fields.description.content.content"),
    #"Expanded Column1.fields.description.content.content1" = Table.ExpandRecordColumn(#"Expanded Column1.fields.description.content.content", "Column1.fields.description.content.content", {"type", "text"}, {"Column1.fields.description.content.content.type", "Column1.fields.description.content.content.text"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1.fields.description.content.content1",{{"Column1.fields.statuscategorychangedate", type datetimezone}})
in
    #"Changed Type"

 

I decided to try using the web api by inputing the API endpoint and using Basic Authentication. This extracted the JSON fine and I've been expanding the JSON values into a usable table. I did hit a snag specifically with the Description field in Jira. It comes out in a list.

 

Figure 1. Jira Issues from a specific project and we're looking at the description field for issues

 

When keep expanding the values to new rows, it seems to generate these weird column values. It seems Jira stores text in each paragraph and line break in separate rows for a single issue. 

 

Figure 2. What you see when you expand out the Description field. Note the 2 content type columns on the left

 

Is there a way to get these description values and put them into a single row against a single issue row as opposed to expanding the table out.

2 Replies

    • Mike282's avatar
      Mike282
      Icon for Helper III rankHelper III

      Hey v-chuncz-msft .

       

      Tried that. I can't extract the value as there are null values. I get the following error. The only other way is to create a reference table and expand out all of the description and link it to the main data table but not sure how to concatenate all that text together.

       

       

      Expression.Error: We cannot convert the value null to type List.
      Details:
      Value=
      Type=[Type]