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
gianfrancob
Frequent Visitor

How to create an effort calendar by resources from tasks with only start and end dates?

Hello, 

 

I would like to create a "calendared" dataset showing the aggregate effort for each resource for each day. 

 

My model consists of:

  1. Resource table: with Id and Name
  2. Tasks table: with resource Id, task id, task start, task end, the effort required
  3. Calendar table: which is the time horizon I would like to calculate the aggregation. 

 

The output should be a table where each row has: each resource and each day, calculate the sum of the effort.

 

Resource 1 | Day 1 | Effort:100

Resource 1 | Day 2 | Effort:50

Resource 1 | Day 3 | Effort:50

Resource 2 | Day 1 | Effort:100

Resource 2 | Day 2 | Effort:100

Resource 2 | Day 3 | Effort:25

 

The challenge I am facing is that the tasks have a start and end date and I am not sure how to build the filters to perform that computation (attached PowerBI model). 

 

Any advice on how to proceed would be greatly appreciated (link to .pbix model: CLICK HERE )

Thank you

 

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

Hi @gianfrancob ,

 

We can create a calculated table as below.

Table 3 = 
VAR k =
    ADDCOLUMNS (
        CROSSJOIN ( DISTINCT ( 'Table'[task_id] ), CALENDARAUTO () ),
        "id", 'Table'[task_id]
    )
VAR eff =
    ADDCOLUMNS (
        k,
        "a", CALCULATE (
            SUM ( Tasks[effort] ),
            FILTER (
                Tasks,
                'Tasks'[task_id] = [id]
                    && [Date] >= Tasks[start_date]
                    && [Date] <= Tasks[end_date]
            )
        )
    )
RETURN
    FILTER ( eff, [a] <> BLANK () && [a] >= 0 )

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 @gianfrancob ,

 

We can create a calculated table as below.

Table 3 = 
VAR k =
    ADDCOLUMNS (
        CROSSJOIN ( DISTINCT ( 'Table'[task_id] ), CALENDARAUTO () ),
        "id", 'Table'[task_id]
    )
VAR eff =
    ADDCOLUMNS (
        k,
        "a", CALCULATE (
            SUM ( Tasks[effort] ),
            FILTER (
                Tasks,
                'Tasks'[task_id] = [id]
                    && [Date] >= Tasks[start_date]
                    && [Date] <= Tasks[end_date]
            )
        )
    )
RETURN
    FILTER ( eff, [a] <> BLANK () && [a] >= 0 )

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.

Hi,

 

thank you for the response, it seems to be working on the test dataset - I will roll that out on the PROD one. 

 

It would be great if you could also explain a few things regarding the solution:

  • You create a table called "Table" where you summarise the Tasks by End Date? Is that correct? what is the rationale?
Table = SUMMARIZECOLUMNS(Tasks[end_date],Tasks[start_date],Tasks[task_id],"value",SUM(Tasks[effort]))
  • When you use CALENDARAUTO() in the cross-join the date range is implicit and is not clear which range the function uses? 

Thank you

 

Best,

 

Gian

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.