Calculate remaining time

Hello,

I have a simple formula for calculating “Remaining time”, but it does not work correctly.

(
([Measures].[Original estimated hours] +
[Measures].[Sub-tasks original estimated hours]
-
([Measures].[Hours spent] +
[Measures].[Sub-tasks hours spent]))
)

If I have the next tasks:
Task_1:
estimate=10 hours
spent_time=6 hours

Task_2:
estimate=12 hours
spent_time=14 hours

my formula will calculate the sum of the remaining time as
(10+12)-(6+14)=22-20=2 hours
but it is incorrect.
for Task_1 remaining_time is 10-6=4 hours
for Task_2 remaining_time is 0 (because we have already spent more time than estimated)
The total sum of remaining time should be 4 hours, not 2 hours as the formula calculated.

As I understand there should be something like cycle “for (…)”, but I can’t find a solution how to write in eazyBI.
I would appreciate your help.

Hello @Oksana_Dovha

It seems that you reached out to us directly.
I’m posting a possible solution here in case other eazyBI users face a similar problem.

For this use case, the import of the inherited field dimension might be useful.
Here is a documentation that explains how to Import the inherited field dimension: JavaScript calculated custom fields

And here is a community post about a similar use-case - Calculating Total user stories based on epics fields - #2 by janis.plume

Best wishes,
Elita from support@eazybi.com