Forum Discussion
Distribute work hours
- 6 years ago
Hi EtienneB1 ,
How about create a calculated table like so:
Crossjoin Table = SUMMARIZE ( FILTER ( ADDCOLUMNS ( CROSSJOIN ( CALENDARAUTO (), 'Table 1', 'Table 2' ), "enddate", [Start Date] + CALCULATE ( SUM ( 'Table 2'[Duration(days)] ) - 1, FILTER ( ALL ( 'Table 2' ), 'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] ) ) ), "Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)] ), VAR StartDate_ = [enddate] - [Duration(days)] + 1 RETURN [Date] <= [enddate] && [Date] >= StartDate_ ), [Date], [Id], [Process Name], [Hours] )For more details, please check the attached .pbix file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi EtienneB1 ,
Perhaps this is more helpful to your understanding:
My understanding is this:
You want to calculate the results of “Qty*Time Per Unit/Duration”.
If my understanding is right, try this:
1. Create a calculated column which is to calculate the duration of progress1 and progress2.
duration1 =
CALCULATE (
SUM ( 'Table 2'[Duration(days)] ),
FILTER (
ALL ( 'Table 2' ),
'Table 2'[Process Name] <= EARLIER ( 'Table 2'[Process Name] )
)
)
2. Create a new table under Modeling.
Table 3 =
VAR mycalendar =
CALENDARAUTO ()
VAR table1 =
ADDCOLUMNS (
CROSSJOIN ( 'Table 1', 'Table 2', mycalendar ),
"EndDate", 'Table 1'[Start Date] + 'Table 2'[duration1]
)
VAR table2 =
ADDCOLUMNS ( table1, "StartDate1", [EndDate] - 'Table 2'[Duration(days)] )
VAR table3 =
ADDCOLUMNS (
FILTER ( table2, [StartDate1] <= [Date] && [EndDate] >= [Date] ),
"Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
)
RETURN
SUMMARIZE (
ADDCOLUMNS (
table3,
"Hours1", [Qty] & "*" & [Time per Unit(hours)] & "/" & [Duration(days)]
),
[Date],
[Id],
[Process Name],
[Hours1],
[Hours]
)
You can check more details from here.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.