Forum Discussion

carolinastylin's avatar
carolinastylin
New Member
2 years ago
Solved

Progress Measure

I built a progress measure that is working but I'm trying to optimize. I have 5 different project types with varying numbers of tasks.  I wrote a measure to divide the total completed tasks by the nu...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi carolinastylin ,

     

    You can try formula like below to create measure:

    CompletedTasks_ProjectType1 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType1",
        NOT(ISBLANK('Table'[CompletionDate]))
    )
    
    CompletedTasks_ProjectType2 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType2",
        NOT(ISBLANK('Table'[CompletionDate]))
    )
    
    CompletedTasks_ProjectType3 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType3",
        NOT(ISBLANK('Table'[CompletionDate]))
    )
    
    IncompleteTasks_ProjectType1 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType1",
        ISBLANK('Table'[CompletionDate])
    )
    
    IncompleteTasks_ProjectType2 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType2",
        ISBLANK('Table'[CompletionDate])
    )
    
    IncompleteTasks_ProjectType3 = 
    CALCULATE(COUNTROWS('Table'), 
        'Table'[ProjectType] = "ProjectType3",
        ISBLANK('Table'[CompletionDate])
    )
    
    Progress = 
    SWITCH(
        TRUE(),
        MAX('Table'[ProjectType]) = "ProjectType1", 
        DIVIDE([CompletedTasks_ProjectType1], [CompletedTasks_ProjectType1] + [IncompleteTasks_ProjectType1], 0),
    
        MAX('Table'[ProjectType]) = "ProjectType2", 
        DIVIDE([CompletedTasks_ProjectType2], [CompletedTasks_ProjectType2] + [IncompleteTasks_ProjectType2], 0),
    
        MAX('Table'[ProjectType]) = "ProjectType3", 
        DIVIDE([CompletedTasks_ProjectType3], [CompletedTasks_ProjectType3] + [IncompleteTasks_ProjectType3], 0),
    
        BLANK()
    )
    

    Best Regards,
    Adamk Kong

     

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