How to build profit & loss report with additional data import

Overview

In this example, JIRA has custom field Cost Center and a file with a budget for each Cost Center per month. Cost calculation goes over logged hours and user rate. Users have flat rates in a seperate file.

The example describes how to import both files into eazyBI, mapping budget to custom field Cost Center and Time, and mapping Rate to Logged by User. You could either upload a file, import data via REST API, or SQL, or use Google Sheets in the same way. eazyBI supports additional data import to any existing default field dimension and single select custom field dimensions as properties or measures.

Budget import

A budget should be imported and mapped to custom field Cost Center and Time. A budget should be imported as Measure to enable mapping by several dimensions. eazyBI by default does not allow additional data import to custom fields. This option should be enabled for a custom field that requires additional data import.

JIRA administrator can enable additional data import in eazyBI advanced settings:

[jira.customfield_NNNNN]
data_type = "string"
dimension = true
separate_table = true

Custom field ID should be used instead of NNNNN. Run an import after custom field definition changes.

Prepare a data source with budget data, over time and the custom field values. You could add any other dimensions there as well. Please split data as detailed as you would need for data analysis later. Upload file or setup connection and query for any other data sources. Then proceed to column mapping.

Select JIRA issue cube for additional data import. You would like to import budget as a measure mapped to two dimensions - custom field dimension and time dimension. Select dimension and level from selections list. Set advanced options for mapping data via Name. Usually, you could map custom field value by Name. Set an option ‘Skip missing’ to ignore lines that do not have a value in the eazyBI. eazyBI does not import lines without a proper match and could raise an error and prevent any data import if this parameter is not set.


Run an import.

Rates import for a user

Cost calculation will be done over logged hours. eazyBI has several user dimensions and in this case Logged by dimension is the most appropriate for rate import to users who have logged hours.

Prepare a data source with usernames and rates. It would be suggested to use a username for mapping as several users could have the same name and surname. Username is unique and would suit better for additional data import. Upload file or setup connection and query for any other data sources. Then proceed to column mapping.

Select JIRA issue cube for additional data import. You would like to import rates as a property mapped to Logged by user on user level. You can import only one property value for each user. Any new property value will override the previous one for the same user.

Select dimension and level from selections list. Set advanced options for mapping data via Key (this selection goes with username). Set an option ‘Skip missing’ to ignore lines that do not match Logged by user in the eazyBI. eazyBI does not import lines without a proper match and could raise an error and prevent any data import if this parameter is not set.


Run an import.

Create a report

A report uses profit/loss calculation subtracting Cost from Budget cumulatively over time to get a value at the end of each period.

Create a calculated measure for “Cost”:

NonZero(SUM(Filter(
  Descendants([Logged by].CurrentMember, [Logged by].[User]),
  [Measures].[Hours spent] > 0),
  [Measures].[Logged by Rate] *
  [Measures].[Hours spent]
))

Create a calculated measure “Cost Center Budget” to get it working in any context in the report:

DefaultContext(
([Measures].[Budget],
[Cost center].CurrentMember,
[Time].CurrentHierarchyMember)
)

Create a calculated measure “Profit/Loss Cumulative” for cumulative profit/loss calculation:

NonZero(SUM(
  {PreviousPeriods([Time].CurrentHierarchyMember),
  [Time].CurrentHierarchyMember},
  [Measures].[Cost Center Budget]
  -
  [Measures].[Cost]
))

Create a report using measure “Profit/Loss Cumulative” on Columns. Use Coste center with Cost center level on Columns as well. Use Time dimension with Month level selected on Rows. Switch your report to Timeline chart. You could also use Bar chart as well.

2 Likes

Hi, thanks for your excellent tutorial! Is there a way to accommodate a users rate changing over time? For example from the date of the users first ever work-log log, until the end of January 2019 the users rate was 60. Then, from the first of February 2019, they get a pay rise to 65, and then from 01 September 2019 they get another rise to 70…and there is potential for more increases in the future.

Can the report be somehow made aware of the users rate at and riven time period, and how would this be represented in the import data/Csv file format?

1 Like

Hi ,

Thank you for the detailed instructions. I was wondering if there’s a way to create new dimensions in the existing Issues cube and then import data from an Excel file into it?

Thank you for the example. However, I have a different problem to solve. I have a google sheet with (user, cost per Sprint). I would like to import the data from the sheet and calculate the cost per story point completed per user, every sprint. In other words, how much do I pay each developer per Story Point during a sprint? The cost per sprint per user will not change often during the year. Please help?
thank you

eazyBI allows creating new dimensions in the issue cube with calculated JavaScript custom fields. If they represent a single value per an individual issue you can import additional similar to how it is described for Cost center.

Daina / support@eazybi.com

You can use a similar approach - import Rate as property per user and use the same calculations as represented by Rate. However, this will not support cases when the cost per sprint changes.

The solution will work for the latest sprints only with this approach. In some cases, it might be enough to get the needed values for the most recent sprints and get the costs per sprint. It won’t allow you to get back in history, though.

If you would like to keep track of costs per each individual sprint the solution will require more maintenance. You would like to import the rate per each user and per each sprint as a measure. You would need to have this mapping for any sprint you would like to calculate the costs. The solution will be more close to the one on how the Cost is imported and used in the formulas. However, you would like to use the user (Logged by or Assignee) dimension and the Sprint dimension instead of Cost center and Time.

You can prepare the file using the report with Sprint dimension and User dimension on Rows. See more here on how to use reports for preparing the import file:

Export the file and set the cost per sprint and user, even if it is the same cost for different sprints.

I removed the columns sprint and assignee from my file. Then make the mapping - by Sprint and User dimension based on Key and Skip missing, set the Measure for the rate:

Then it will be imported and you can use them in the calculations:

Please do not use the calculation directly, apply the formula and then use this formula in reports with other dimensions:

DefaultContext(
([Measures].[User rate per sprint],
[Assignee].CurrentHierarchyMember,
[Sprint].CurrentHierarchyMember)
)

Daina / support@eazybi.com