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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Splitting hours between working days

Hi

 

I've been sent on a task to make a capacity plan for the production.

 

I have a table with actual and budget hours for each production order. This yield a deviation, which are the the remaining hours for production. 

 

The number of remaining hours should then be split into pieces of max 7,4 hours until there is no remaining production orders.

 

bi 06-05-.PNG

 

Is this achieveable somehow?

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

One sample for your reference. Please check the following step as below.

 

1. Create a date table as below.

Table = var k =CALENDAR(DATE(2019,05,01),DATE(2019,05,31))
return
FILTER(k,WEEKDAY([Date],2)<=5)

2. Crossjoin the two tables.

Table 2 = var k =CROSSJOIN('Table',Table1)
return
ADDCOLUMNS(FILTER(k,[Date]>=Table1[Real date]),"value",0-[remaining])

3, Create a calculated column in table 2.

Hrs = 
VAR ms =
    CALCULATE (
        COUNT ( 'Table 2'[order no] ),
        FILTER (
            'Table 2',
            'Table 2'[order no] = EARLIER ( 'Table 2'[order no] )
                && 'Table 2'[Date] <= EARLIER ( 'Table 2'[Date] )
        )
    ) * 7.4
VAR i = ms - 'Table 2'[value]
VAR result =
    IF ( 'Table 2'[value] > ms, 7.4, 7.4 - i )
RETURN
    IF ( result > 0, result, BLANK () )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

One sample for your reference. Please check the following step as below.

 

1. Create a date table as below.

Table = var k =CALENDAR(DATE(2019,05,01),DATE(2019,05,31))
return
FILTER(k,WEEKDAY([Date],2)<=5)

2. Crossjoin the two tables.

Table 2 = var k =CROSSJOIN('Table',Table1)
return
ADDCOLUMNS(FILTER(k,[Date]>=Table1[Real date]),"value",0-[remaining])

3, Create a calculated column in table 2.

Hrs = 
VAR ms =
    CALCULATE (
        COUNT ( 'Table 2'[order no] ),
        FILTER (
            'Table 2',
            'Table 2'[order no] = EARLIER ( 'Table 2'[order no] )
                && 'Table 2'[Date] <= EARLIER ( 'Table 2'[Date] )
        )
    ) * 7.4
VAR i = ms - 'Table 2'[value]
VAR result =
    IF ( 'Table 2'[value] > ms, 7.4, 7.4 - i )
RETURN
    IF ( result > 0, result, BLANK () )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

You're a genious btw. This is brilliant!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.