Hi @pchampet
Thanks for the replies! This helped me understand exactly what you intend to achieve in the report!
For this to work, you should import your custom date fields “Start date” and “End date” into this eazyBI report account. You can select them for import in the import options: Data from Jira
For the “Estimated hour counter” you can define a new calculated measure in the Measures dimension and use the following formula for it:
Sum(
Filter(
Descendants([Issue].CurrentMember,[Issue].[Issue]), -- iterate through all issues
-- select the issues that have started before the end of the month currently in Rows
DateBeforePeriodEnd(
[Measures].[Issue Start date],
[Time].CurrentHierarchyMember
)
AND -- and that have also the end date after the end of previous month in Rows
DateAfterPeriodEnd(
[Measures].[Issue End date],
[Time].CurrentHierarchyMember.PrevMember
)
AND -- and that also have estimated hours
(
[Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember
) > 0
),
CASE WHEN -- if the issue has started in the current Rows month
DateInPeriod(
[Measures].[Issue Start date],
[Time].CurrentHierarchyMember
)
THEN
CASE WHEN -- and if it has also ended in this Rows month
DateInPeriod(
[Measures].[Issue End date],
[Time].CurrentHierarchyMember
)
THEN -- then calculate the days between start and end date
DateDiffDays(
[Measures].[Issue Start date],
[Measures].[Issue End date]
) * -- and multiply by estimated hours divided by the total number of days between start and end date
([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)
/
DateDiffDays([Measures].[Issue Start date],
[Measures].[Issue End date])
ELSE -- if it has ended in a different(future) month, then calculate the days between start date and end of the month
DateDiffDays(
[Measures].[Issue Start date],
[Time].CurrentHierarchyMember.NextStartDate
) *
([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)
/
DateDiffDays([Measures].[Issue Start date],
[Measures].[Issue End date])
END
ELSE -- if the issue has started before the current Rows month
CASE WHEN -- but it has ended in this Rows month
DateInPeriod(
[Measures].[Issue End date],
[Time].CurrentHierarchyMember
)
THEN -- then calculate the difference between the start of the month and the issue end date
DateDiffDays(
[Time].CurrentHierarchyMember.StartDate,
[Measures].[Issue End date]
) *
([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)
/
DateDiffDays([Measures].[Issue Start date],
[Measures].[Issue End date])
ELSE -- if the issue has started before and ended after the current Rows month, then count the total number of days in month
DateDiffDays(
[Time].CurrentHierarchyMember.StartDate,
[Time].CurrentHierarchyMember.NextStartDate
) *
([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)
/
DateDiffDays([Measures].[Issue Start date],
[Measures].[Issue End date])
END
END
)
I’ve added some comments in the formula to describe what is being done in each step, but let me know if you have any additional questions on this!
Things to note:
- Please make sure that you use the current [Issue Start date] and End date property members, they may have a slightly different name depending on how they are named in your Jira, and you may need to adjust them in the formula (the eazyBI auto-suggest should offer you the correct names when fixing them)
- Set the Formatting for this formula to Numeric → Decimal
- This formula uses the DateDiffDays() formula that calculates the total number of days from the first day till the last day. However, it doesn’t include the last date, but from your example, I assume that you want to also include the last date, so there are a bunch of +1’s scattered around the formula to include the end date where it is needed.
- If you would like to exclude the non-working days from the equation, you can replace the DateDiffDays() function with DateDiffWorkdays() function.
- This formula returns the sum of Estimations in hours, if you would like to see the sum in days, you can replace all the:
([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)
with:
(([Measures].[Original estimated hours],
[Time].CurrentHierarchy.DefaultMember)/24)
- As the Issues have no “real” connection to the Date members that they are “passing through” you may want to disable the “Nonempty” option in Rows and use “Hide empty rows” instead to show all the date members between Start and End dates of Issues.
- If you have some missing dates in your Time dimension (dates that are not present in Jira, thus are missing from the Time dimension), then you can add them manually by clicking the Add members for date range.
Let me know if this works as expected!
Nauris