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
Anonymous
Not applicable

Project status respect to no of tasks and sub projects in the table

Hi

 

I have attached ,input and required output in the below location. Could someone help me to figure it out how to get overall project status in  a table and also status of subprojects in another table with respect to tasks.

 

https://www.dropbox.com/scl/fi/tv58upbxs9shu66hcxukc/Sample.xlsx?dl=0&rlkey=pw1vek4klr0fxh4oy4sbnr1l...

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Firstly, we need to add a [TaskNo] column in the table, we will need it in the calculation below.

Measure:

Latest Actual Finish (Matrix) = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF (
        _COUNT = 1
            && "Completed" IN _STATUS_LIST,
        MAX ( 'Table'[Actual Finish] ),
        CALCULATE (
            MAX ( 'Table'[Actual Finish] ),
            FILTER ( 'Table', 'Table'[TaskName] = MAX ( 'Table'[TaskName] ) )
        )
    )
Latest Actual Finish (Table) = 
VAR _MAXDATE = MAX('Table'[Actual Finish])
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID])
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
IF( _COUNT =1 && "Completed" IN _STATUS_LIST, _MAXDATE,BLANK())
M_Actual Hours = 
VAR _ADDCOLUMN =
    ADDCOLUMNS (
        'Table',
        "Flag",
            VAR _STATUS_LIST =
                CALCULATETABLE (
                    VALUES ( 'Table'[Status] ),
                    ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
                )
            VAR _COUNT =
                COUNTAX ( _STATUS_LIST, [Status] )
            VAR _NEXTTASK =
                CALCULATE (
                    MIN ( 'Table'[TaskNo] ),
                    FILTER (
                        ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] ),
                        'Table'[TaskNo] > EARLIER ( 'Table'[TaskNo] )
                    )
                )
            VAR _MAXTASK =
                CALCULATE (
                    MAX ( 'Table'[TaskNo] ),
                    ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
                )
            RETURN
                IF (
                    _COUNT = 1
                        && "Completed"
                        IN _STATUS_LIST
                        && 'Table'[TaskNo] = _MAXTASK,
                    1,
                    CALCULATE (
                        MAX ( 'Table'[Actual Start] ),
                        FILTER (
                            ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] ),
                            'Table'[TaskNo] = _NEXTTASK
                        )
                    )
                )
    )
RETURN
    SUMX ( FILTER ( _ADDCOLUMN, [Flag] <> BLANK () ), [Actual Hours] )
Status (Table) = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF (
        "In Progress" IN _STATUS_LIST,
        "In Progress",
        IF ( "Not Started" IN _STATUS_LIST, "Not Started", MAX ( 'Table'[Status] ) )
    )

Then create visuals by sum/avg/min/max function in visual and measures. Result is as below.

Table visual:

RicoZhou_0-1651484201069.png

Matrix visual:

RicoZhou_1-1651484208011.png

You can download my sample file to learn more details

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
Anonymous
Not applicable

I have attached one output, if you add status for each sub projects , it shows projects that are 100% complete , also in progress, instead of completed. Could you help on that

 

sur2307_0-1651496236171.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Try this measure to calculate Status in matrix.

Status (Matrix) =
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF (
        _COUNT = 1,
        IF ( "Completed" IN _STATUS_LIST, "Completed", "Not Started" ),
        "In Progress"
    )

Result is as below.

RicoZhou_0-1651653335855.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @Anonymous ,

 

Firstly, we need to add a [TaskNo] column in the table, we will need it in the calculation below.

Measure:

Latest Actual Finish (Matrix) = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF (
        _COUNT = 1
            && "Completed" IN _STATUS_LIST,
        MAX ( 'Table'[Actual Finish] ),
        CALCULATE (
            MAX ( 'Table'[Actual Finish] ),
            FILTER ( 'Table', 'Table'[TaskName] = MAX ( 'Table'[TaskName] ) )
        )
    )
Latest Actual Finish (Table) = 
VAR _MAXDATE = MAX('Table'[Actual Finish])
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID])
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
IF( _COUNT =1 && "Completed" IN _STATUS_LIST, _MAXDATE,BLANK())
M_Actual Hours = 
VAR _ADDCOLUMN =
    ADDCOLUMNS (
        'Table',
        "Flag",
            VAR _STATUS_LIST =
                CALCULATETABLE (
                    VALUES ( 'Table'[Status] ),
                    ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
                )
            VAR _COUNT =
                COUNTAX ( _STATUS_LIST, [Status] )
            VAR _NEXTTASK =
                CALCULATE (
                    MIN ( 'Table'[TaskNo] ),
                    FILTER (
                        ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] ),
                        'Table'[TaskNo] > EARLIER ( 'Table'[TaskNo] )
                    )
                )
            VAR _MAXTASK =
                CALCULATE (
                    MAX ( 'Table'[TaskNo] ),
                    ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] )
                )
            RETURN
                IF (
                    _COUNT = 1
                        && "Completed"
                        IN _STATUS_LIST
                        && 'Table'[TaskNo] = _MAXTASK,
                    1,
                    CALCULATE (
                        MAX ( 'Table'[Actual Start] ),
                        FILTER (
                            ALLEXCEPT ( 'Table', 'Table'[ProjectID], 'Table'[Project Name], 'Table'[WBS] ),
                            'Table'[TaskNo] = _NEXTTASK
                        )
                    )
                )
    )
RETURN
    SUMX ( FILTER ( _ADDCOLUMN, [Flag] <> BLANK () ), [Actual Hours] )
Status (Table) = 
VAR _STATUS_LIST =
    CALCULATETABLE (
        VALUES ( 'Table'[Status] ),
        ALLEXCEPT ( 'Table', 'Table'[ProjectID] )
    )
VAR _COUNT =
    COUNTAX ( _STATUS_LIST, [Status] )
RETURN
    IF (
        "In Progress" IN _STATUS_LIST,
        "In Progress",
        IF ( "Not Started" IN _STATUS_LIST, "Not Started", MAX ( 'Table'[Status] ) )
    )

Then create visuals by sum/avg/min/max function in visual and measures. Result is as below.

Table visual:

RicoZhou_0-1651484201069.png

Matrix visual:

RicoZhou_1-1651484208011.png

You can download my sample file to learn more details

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.