Forum Discussion

Kusaadigarla01's avatar
Kusaadigarla01
Frequent Visitor
1 year ago
Solved

Requirement: Decomposition Tree for Process Management

Hi, Please help in below requirement. and check the sample data below for this requirement. Requirement: Decomposition Tree for Process Management We need to create a decomposition tree for pr...
  • Kusaadigarla01's avatar
    Kusaadigarla01
    1 year ago

    Hi, Thanks for your help.

    Actually it was working for sample data which i have provided in query but when i apply same logic on real time data(same kind of data) it was not working.

    Tried the different logic and it is working.

    check the logic below.

     

    TaskStatusColor_Corrected =
    VAR CurrentNodeLevel =
        SWITCH(
            TRUE(),
            NOT(ISBLANK(SELECTEDVALUE('Sheet1'[Input]))), "Input",
            NOT(ISBLANK(SELECTEDVALUE('Sheet1'[Sub Function]))), "Sub Function",
            NOT(ISBLANK(SELECTEDVALUE('Sheet1'[Business Function]))), "Business Function",
            "Head"
        )

    VAR HasPendingChildren =
        SWITCH(
            CurrentNodeLevel,
            "Input", SELECTEDVALUE('Sheet1'[Status New]) <> "Completed",
            "Sub Function",
                CALCULATE(
                    COUNTROWS(FILTER('Sheet1', 'Sheet1'[Status New] = "Pending")),
                    ALLEXCEPT('Sheet1', 'Sheet1'[Sub Function])
                ) > 0,
            "Business Function",
                CALCULATE(
                    COUNTROWS(FILTER('Sheet1', 'Sheet1'[Status New] = "Pending")),
                    ALLEXCEPT('Sheet1', 'Sheet1'[Business Function])
                ) > 0,
            "Head",
                CALCULATE(
                    COUNTROWS(FILTER('Sheet1', 'Sheet1'[Status New] = "Pending")),
                    ALL('Sheet1')
                ) > 0,
            FALSE()
        )

    RETURN
        IF(HasPendingChildren, "Red", "Green")
     
    Regards,
    Kusa