Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
EtienneB1
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
Icey
Community Support
Community Support

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
Icey
Community Support
Community Support

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.

Icey
Community Support
Community Support

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.

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?

Icey
Community Support
Community Support

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

 

 

amitchandak
Super User
Super User

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

 

example

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.