Power BI only counts JIRA Time Spent instead of summing

Kian Pariwar
Contributor
November 25, 2016

I am currently testing Power BI and connection with JIRA worked perfectly. The template is also fine but I would like to customize it.

One of the customization options is to see the sum of time spent on an issue type. Streangely, the filters in Power BI only let me to count the time spent field instead of summing it.

A little bit of googling revealed that that Power BI only support Count function if there is text in the column / or NULLs instead of numbers. And this can only be fixed by editing the data model.

Problem: I do not see the option to edit the datamodel.

Any idea how to fix this?

3 answers

1 vote
Matt Watt
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 9, 2018

If you start with the Power BI JIRA package (https://powerbi.microsoft.com/en-us/blog/explore-your-jira-data-with-power-bi/), you can then create a function to collect worklogs, and add a custom column to invoke the function, pointing to the column containing the JIRA issue ids, which can be used to form the REST request.

The following query can be used for the function (use New Query -> Blank Query, then Advanced Editor in PowerBI), which will send a request for the worklog for a given issue, then split the worklog into all of the record components that are returned:

(issue as text) as table =>
let
Source = Json.Document(Web.Contents("JIRAURL/rest/api/2/issue/" & issue & "/worklog")),
hasResults=Source[total],
worklogsII = if hasResults > 0 then Source[worklogs] else null,
#"Converted to Table" = if hasResults > 0 then Table.FromList(worklogsII, Splitter.SplitByNothing(), null, null, ExtraValues.Error) else null,
#"Expanded Column1" = if hasResults > 0 then Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"author", "updateAuthor", "comment", "created", "updated", "started", "timeSpent", "timeSpentSeconds", "id", "issueId"}, {"Column1.author", "Column1.updateAuthor", "Column1.comment", "Column1.created", "Column1.updated", "Column1.started", "Column1.timeSpent", "Column1.timeSpentSeconds", "Column1.id", "Column1.issueId"}) else Table.FromValue("Empty")
in
#"Expanded Column1"

Pau Bustillo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2019

It works! Thanks a lot

Lucas Sain September 29, 2020

Hi Matt an Pau. I'm not a tecnical guy. I'm trying to get thgis solution to work. I need ot get the Worklogs from Jira but have no success. I added this querry to the PowerBI but it doesn't work. Not sure what u'm missing. I already got the package to work (that was easy). 

Tomás Rodríguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2021

Try with this, where URL is "https://myspacename.atlassian.net":

 

let
Origen = (URL, id_issue) => let
Source = Json.Document(Web.Contents(URL&"/rest/api/latest/issue/"&id_issue&"/worklog")),
#"Convertido en tabla" = Record.ToTable(Source),
#"Tabla transpuesta" = Table.Transpose(#"Convertido en tabla"),
#"Encabezados promovidos" = Table.PromoteHeaders(#"Tabla transpuesta", [PromoteAllScalars=true]),
#"Tipo cambiado" = Table.TransformColumnTypes(#"Encabezados promovidos",{{"startAt", Int64.Type}, {"maxResults", Int64.Type}, {"total", Int64.Type}, {"worklogs", type any}}),
#"Se expandió worklogs" = Table.ExpandListColumn(#"Tipo cambiado", "worklogs"),
#"Se expandió worklogs2" = Table.ExpandRecordColumn(#"Se expandió worklogs", "worklogs", {"started", "timeSpent", "timeSpentSeconds", "comment"}, {"started", "timeSpent", "timeSpentSeconds", "comment"})
in
#"Se expandió worklogs2"
in
Origen

Tomás Rodríguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2021

I have just realized that, if you change the sentence "Source = Json.Document(Web.Contents("JIRAURL/rest/api/2/issue/" & issue & "/worklog"))," by Source = Json.Document(Web.Contents("JIRAURL/rest/api/latest/issue/" & issue & "/worklog")), Matt Watts' code works perfectly.

0 votes
Andrejs Nesterenko April 9, 2017

Have anybody managed to solve this issue?  It would be VERY helpful!

Eric Kish April 9, 2017
Andrejs Nesterenko April 9, 2017

Ok, thank you for the idea! But still, is it possible to intergate JIRA data in Power BI Cloud well?

Eric Kish April 9, 2017

Not that I know of

0 votes
Eric Kish December 11, 2016

I have exactly the same problem. It is because the JIRA app makes all the fields non-numeric when connecting to PowerBI. I have no idea how to solve this ...

Suggest an answer

Log in or Sign up to answer