Forum Discussion

threenub's avatar
threenub
Regular Visitor
7 years ago
Solved

Building a sequence based on rows containing 'current' and 'next' columns

Hi All,   I am working on some reports for a workflow system and I am struggling to find a way to build a table that shows the workflow sequence in steps.   I am trying to determine take data in ...
  • v-yulgu-msft's avatar
    7 years ago

    Hi threenub,

     

    Add an index column in Query Editor mode first.

     

    Then, in data view, create a calculated table as below.

    Table_3 =
    UNION (
        SELECTCOLUMNS (
            Table_2,
            "WorkflowName", Table_2[WorkflowName],
            "StepNumber", Table_2[Index],
            "StepName", Table_2[CurrentStepName]
        ),
        SELECTCOLUMNS (
            FILTER (
                Table_2,
                Table_2[Index]
                    = CALCULATE (
                        MAX ( Table_2[Index] ),
                        ALLEXCEPT ( Table_2, Table_2[WorkflowName] )
                    )
            ),
            "WorkflowName", Table_2[WorkflowName],
            "StepNumber", Table_2[Index],
            "StepName", Table_2[NextStepName]
        )
    )

     

    Best regards,

    Yuliana Gu