Sum the value of sub-task based on main task information

Hi,

We’ve a project where we store information regarding some customers.
The customers are issue type with a field “Country” where we associate the country of our customer.
Then, we create some sub-task to manage their order.

I would like to create a report where I can see the value that they ordered, this value is stored in the sub-task and it doesn’t have the country because it’s associated to the main task.

How may I do this?
You can find an “example” here :

  • I would like to get columns for products
  • First level are the countries
  • Second level the customer (IssueType : Main issue)
  • Third level the order with the value of the product (Sub-task)

Goal is to get pie chart per product for any country and if necessary go further and check the customer and the order.

What do you think?

Best

Hi Guillaume,

Sorry for the wait for the reply!
The idea here is that you would need to inherit the country custom field value from the Parent issue to the sub-tasks. Here are couple of examples how to do it with Javascript calculated custom field:

Note that you would use the following parameter for inheriting from standard Parent hierarchy: update_from_issue_key = "subtask_parent_key"

Please let me know if you have further questions regarding this!
Lauma / support@eazybi.com

Hi @lauma.cirule,

Thanks for the info. I finally got what was needed with :
Advanced settings :
[jira.customfield_18870]
name = “Organisation country”
dimension = true
data_type = “string”
update_from_issue_key = “parent_issue_key”
javascript_code=’’’
if (issue.fields.customfield_18870) {
issue.fields.customfield_position_inherited=issue.fields.customfield_18870.value;
}’’’

My “custom field” has been created and I’m able to use it as a dimension and a property! Perfect.
Then, I would like to be able to filter it based on the value. In this example it’s for the country and I would like to get only for France (Use the search and bookmark and it’s ok) and then I would like to have another new calculated member with anything which is not France.

How can I do that?

In advance, thank you.

Hi @Guillaume_Lorquet,

To filter you would add the Country dimension in pages and select the Country you wish to see data for. You can use the property on rows and dimension in pages, or use the dimension both on rows and pages.

To select all except France, you can create a calculated member using Aggregate(…) and Except(…) functions

Aggregate(
  Except(
    [Organisation country].[Organisation country].Members,
    { [Organisation country].[France] }
  )
)

Lauma / support@eazybi.com

Hi @lauma.cirule,

Thx for your reply. It works fine!

But, when I try to filter on :

  1. ALL (Basic one gives me a total of 1157 issues
    Screenshot 2020-09-29 at 11.22.41
  2. I used “France’s customers” and with your code, I also created “Belgium’s customers” (so all except France). I used both and only get something like 612 issues…
    Screenshot 2020-09-29 at 11.42.15
  3. I tried with multiple selection from “ALL” and select all possibilities, I get 612 issues…
    Screenshot 2020-09-29 at 11.22.54 Screenshot 2020-09-29 at 11.23.06

-> Why don’t I get the same result here?

Best,
Guillaume

Hi @Guillaume_Lorquet,

I just noticed that you have an incorrect definition for the inheriting Organisation countries. Sorry for not seeing this before!
I imagine because of incorrect definition this is showing totals only for parent issues.

Please modify the advanced settings as follows

[jira.customfield_position_inherited]
name = "Inherited Organisation countries"
data_type = "string"
dimension = true
update_from_issue_key = "subtask_parent_key"
javascript_code = '''
  if(issue.fields.customfield_18870 && issue.fields.customfield_18870.value) {
    issue.fields.customfield_position_inherited = issue.fields.customfield_18870.value;
}
'''

After importing the Inherited Organisation countries as dimension and property (with the above definition in advanced settings), take one sub-task issue, and make sure that it is showing the correct parent country.

Lauma / support@eazybi.com

Hi @lauma.cirule,

Just updated but the issue is still here… Removed all filter, etc. Only keep issue created per country.
When I collapse :
Screenshot 2020-09-29 at 14.07.58
When I expand :
Screenshot 2020-09-29 at 14.08.03
The total value when expanded is correct but doesn’t match with the “All Countries” value. If I collapse, the quantity is 1199???

I don’t understand…

Hi @Guillaume_Lorquet,

Can you please write to support@eazybi.com (mention this community thread) so we can agree on a debugging call?

Lauma / support@eazybi.com

@Guillaume_Lorquet,

I will post an update for the community here as well:

  1. We found that there was a JQL filter not to import old parent issues. For this reason, the inheriting of Parent countries did not fully work (as there was no value to inherit), and also Total was showing incorrectly.
  2. Another problem was a typo in the settings above; I have fixed that in my original reply.

Lauma / support@eazybi.com

Hi @lauma.cirule, thanks again for your precious help! Such a pleasure to talk with someone who brings a solution so fast :slight_smile: !
I updated all reports that we use following your recommendations and it fixed all our issues!

Thanks again

1 Like