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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
efebo
Frequent Visitor

I need to calculate the percentage of tasks completed on time by each user

Hi,

 

I'm new to Power BI and I need some help, please.

 

I have a table of tasks and each one has two parts, part 1 is done by User X and part 2 is done by User Z. That said, I need to calculate the percentage of tasks completed on time by each user.

 

Task NameCompletedOnTimeByUserXCompletedOnTimeByUserZ
Task 111
Task 201
Task 311
Task 400
Task 511
% of completion on timeN%N%

 

1 indicates on time and 0 late

 

Thanks in advance. 

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

Hi @efebo 

You could create measures

Capture5.JPG

Measure X =
VAR p1 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table 2'[Task Name] ),
        FILTER (
            ALL ( 'Table 2' ),
            'Table 2'[CompletedOnTimeByUserX] = 1
        )
    )
        / CALCULATE (
            DISTINCTCOUNT ( 'Table 2'[Task Name] ),
            ALL ( 'Table 2' )
        )
RETURN
    IF (
        ISINSCOPE ( 'Table 2'[Task Name] ),
        FORMAT (
            SUM ( 'Table 2'[CompletedOnTimeByUserX] ),
            "General Number"
        ),
        FORMAT (
            p1,
            "Percent"
        )
    )

Measure Y =
VAR p2 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table 2'[Task Name] ),
        FILTER (
            ALL ( 'Table 2' ),
            'Table 2'[CompletedOnTimeByUserZ] = 1
        )
    )
        / CALCULATE (
            DISTINCTCOUNT ( 'Table 2'[Task Name] ),
            ALL ( 'Table 2' )
        )
RETURN
    IF (
        ISINSCOPE ( 'Table 2'[Task Name] ),
        FORMAT (
            SUM ( 'Table 2'[CompletedOnTimeByUserZ] ),
            "General Number"
        ),
        FORMAT (
            p2,
            "Percent"
        )
    )

Best Regards
Maggie
Community Support Team _ Maggie Li
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

4 REPLIES 4
efebo
Frequent Visitor

Thank you very much for both @v-juanli-msft and @ryan_mayu 

v-juanli-msft
Community Support
Community Support

Hi @efebo 

You could create measures

Capture5.JPG

Measure X =
VAR p1 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table 2'[Task Name] ),
        FILTER (
            ALL ( 'Table 2' ),
            'Table 2'[CompletedOnTimeByUserX] = 1
        )
    )
        / CALCULATE (
            DISTINCTCOUNT ( 'Table 2'[Task Name] ),
            ALL ( 'Table 2' )
        )
RETURN
    IF (
        ISINSCOPE ( 'Table 2'[Task Name] ),
        FORMAT (
            SUM ( 'Table 2'[CompletedOnTimeByUserX] ),
            "General Number"
        ),
        FORMAT (
            p1,
            "Percent"
        )
    )

Measure Y =
VAR p2 =
    CALCULATE (
        DISTINCTCOUNT ( 'Table 2'[Task Name] ),
        FILTER (
            ALL ( 'Table 2' ),
            'Table 2'[CompletedOnTimeByUserZ] = 1
        )
    )
        / CALCULATE (
            DISTINCTCOUNT ( 'Table 2'[Task Name] ),
            ALL ( 'Table 2' )
        )
RETURN
    IF (
        ISINSCOPE ( 'Table 2'[Task Name] ),
        FORMAT (
            SUM ( 'Table 2'[CompletedOnTimeByUserZ] ),
            "General Number"
        ),
        FORMAT (
            p2,
            "Percent"
        )
    )

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-juanli-msft,

 

Let's say now I need to calculate the percentage of tasks completed by the department. What do I need to change?

The user wants to know the % completed by department AND user?

 

Do I need to create another measure?

 

Can I combine both?

 

Thanks in advance.

 

 

ryan_mayu
Super User
Super User

@efebo 

 

Is this what you want?

 

Completeontime% = sum('Table'[comeleted on time])/COUNT('Table'[comeleted on time])

1.PNG2.PNG 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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