cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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:

EtienneB1_0-1596760010424.png

 

Table 2:

EtienneB1_1-1596760056597.png


Result:

 

EtienneB1_2-1596760097446.png

 

Please Help I have been stuck here for weeks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Distribute work hours

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]
)

crossjoin.PNG

 

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.

View solution in original post

5 REPLIES 5
Highlighted
Super User IX
Super User IX

Re: Distribute work hours

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

 

example

addcolumns(crorsstable(Table1, Table2), "Hours" , divide([Qty]*[Time per unit(Hour)],[Duration]))



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Community Support
Community Support

Re: Distribute work hours

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]
)

crossjoin.PNG

 

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.

View solution in original post

Highlighted
Community Support
Community Support

Re: Distribute work hours

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] )
    )
)

duration1.png

 

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]
    )

table3-1.png

 

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
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

 

 

Helpful resources

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 Kudoed Authors