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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
salafoo
Helper I
Helper I

KPI calculation for a dynamic range of activities

Hello All,

 

I hope everyone is doing well.

 

I am currently working on developing a code to measuring KPI of an employee/department using a dataset that may contain a dynamci range of similar activities per user.

 

Below an example of activities conducted for a payment request, where I have added column 'Duration' manually using excel.

 

Parent Ref.Status ReportCreated OnDuration (end date - start date)
Payment Request 01Customer: Submit Payment Request21-03-190
Payment Request 01Verifier: Send Back to Portal08-04-1918
Payment Request 01Customer: Submit Payment Request19-05-1941
Payment Request 01Verifier: Submit for Checker Review20-05-191
Payment Request 01Checker: Send Back to Maker21-05-191
Payment Request 01Verifier: Submit for Checker Review25-05-194
Payment Request 01Checker: Send Back to Maker26-05-191
Payment Request 01Verifier: Send Back to Portal10-06-1915
Payment Request 01Customer: Submit Payment Request20-06-1910
Payment Request 01Verifier: Submit for Checker Review25-06-195
Payment Request 01Checker: Submit to Auditor28-06-193
Payment Request 01Accountant Mark as Committed - Transfer29-06-191

 

On the other hand, I have a table summurizies the main informantion of the payment request (e.g. amount, customer name, etc). where I would like to add to it the duration taken by each user using the above mentioned table.

 

The total  duration should be as following:

Verifier Duration43
Checker Duration5
Accountatn Duration1

 

 

Would you mind helping me with finding the right code for this report.

 

many thanks

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @salafoo ,

 

If I took your question correctly then you can create a new table with below code:-

Table 2 =
SUMMARIZE (
    'Table (3)',
    "Verifier Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Verifier" )
        ),
    "Checker Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Checker" )
        ),
    "Accountant Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Accountant" )
        )
)

 

Output:-

Samarth_18_0-1648629765666.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

1 REPLY 1
Samarth_18
Community Champion
Community Champion

Hi @salafoo ,

 

If I took your question correctly then you can create a new table with below code:-

Table 2 =
SUMMARIZE (
    'Table (3)',
    "Verifier Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Verifier" )
        ),
    "Checker Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Checker" )
        ),
    "Accountant Duration",
        CALCULATE (
            SUM ( 'Table (3)'[Duration (end date - start date)] ),
            CONTAINSSTRING ( 'Table (3)'[Status Report], "Accountant" )
        )
)

 

Output:-

Samarth_18_0-1648629765666.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors