Forum Discussion

stefanycheck's avatar
stefanycheck
Frequent Visitor
8 years ago
Solved

Count everytime a status change

Hi!   I have this data bellow where "sentido" is the column of status. And "despejando produto"(let's call it status 1) and "mechendo produto" (let's call it status 2) are the two possible status. ...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    stefanycheck

     

    Try this calculated column

     

    EarliestIndex =
    VAR Temp =
        CALCULATE (
            MAX ( [Index] ),
            FILTER (
                Table1,
                [Index] < EARLIER ( [Index] )
                    && [STATUS] <> EARLIER ( [STATUS] )
            )
        )
    VAR Temp1 =
        CALCULATE (
            MIN ( [Index] ),
            FILTER (
                Table1,
                [Index] > EARLIER ( [Index] )
                    && [STATUS] <> EARLIER ( [STATUS] )
            )
        )
    RETURN
        IF ( [Index] > temp && OR ( [Index] < temp1, ISBLANK ( temp1 ) ), temp + 1, 0 )

    Then put the distinct count of this column along with the STATUS in a TABLE visual