cancel
Showing results for
Did you mean:
Highlighted
Regular Visitor

## Distribute work hours

Hello,

I need to forecast work hours distributing the hour through the duration day.

I will use an example to be more clear.

I want to know how many hours per day I will need to work.

How I create a table that looks like the result?

Table1:

Table 2:

Result:

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support

## Re: Distribute work hours

Hi @EtienneB1 ,

How about create a calculated table like so:

``````Crossjoin Table =
SUMMARIZE (
FILTER (
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.

5 REPLIES 5
Highlighted
Super User IX

## Re: Distribute work hours

@EtienneB1 , You can use crosstable with addcolumns, summarize, summarizecolumns

example

Proud to be a Super User!

Highlighted
Community Support

## Re: Distribute work hours

Hi @EtienneB1 ,

How about create a calculated table like so:

``````Crossjoin Table =
SUMMARIZE (
FILTER (
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.

Highlighted
Community Support

## Re: Distribute work hours

Hi @EtienneB1 ,

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 =
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 =
FILTER ( table2, [StartDate1] <= [Date] && [EndDate] >= [Date] ),
"Hours", [Qty] * [Time per Unit(hours)] / [Duration(days)]
)
RETURN
SUMMARIZE (
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.

Highlighted
Regular Visitor

## Re: Distribute work hours

Thank you so much for your help.
One more thing, If I have IDs that has different workflow, What I mean that doesn't do all the processes maybe skip one or few.
How I can do it?

Highlighted
Community Support

## Re: Distribute work hours

Hi @EtienneB1 ,

I don't quite understand the scenario you mentioned. Please give me a specific example to help me better understand your requirements.

Best Regards,

Icey

Announcements

#### August Community Highlights

Check out a full recap of the month!

#### August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

#### Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors