Forum Discussion

RShackelford's avatar
RShackelford
Frequent Visitor
5 years ago
Solved

Yet Another Consecutive Values Question

I've seen this question asked quite a bit, but I can't seem to find a solution that works for me or doesn't thoroughly confuse me.  I'd like to create a calculated column that counts consecutive "...
  • Jihwan_Kim's avatar
    Jihwan_Kim
    5 years ago

    Hi, RShackelford 

    Thank you for your feedback.

    Please check the below.

     

     

    Step one Second Version =
    VAR currentserver = Data[Server]
    VAR currentdate = Data[Date]
    VAR flagcumulate =
    IF (
    Data[Indicator] = "good",
    BLANK (),
    SUMX (
    ADDCOLUMNS (
    SUMMARIZE (
    FILTER ( Data, Data[Server] = currentserver && Data[Date] <= currentdate ),
    Data[Server],
    Data[Date],
    Data[Indicator]
    ),
    "@flag", IF ( Data[Indicator] = "good", 1, 0 )
    ),
    [@flag]
    )
    )
    RETURN
    flagcumulate
     
     
    Result CC Second Version =
    VAR currentstepone = Data[Step one Second Version]
    VAR currentserver = Data[Server]
    VAR newtable =
    FILTER (
    Data,
    Data[Server] = currentserver
    && Data[Step one Second Version] == currentstepone
    )
    VAR result =
    COUNTROWS ( newtable )
    RETURN
    IF ( Data[Indicator] = "good" || result <= 1, "Don't care", result & "Bads" )