Forum Discussion

damj's avatar
damj
Frequent Visitor
6 years ago
Solved

consecutive day

Hi. Trying to create a column that counts consecutive days based on "Eventkode" sorted in "Litra" like the illustration shown below. Hope someone can help. Thanks in advance.
  • v-juanli-msft's avatar
    6 years ago

    Hi damj 

    Create calculated columns

    clc1 = CALCULATE(DISTINCTCOUNT('Table'[date]),FILTER(ALLEXCEPT('Table','Table'[litra]),[date]<=EARLIER('Table'[date])))
    
    earlier day = CALCULATE(MAX('Table'[date]),FILTER(ALLEXCEPT('Table','Table'[litra]),'Table'[date]=EARLIER('Table'[date])-1))
    
    clc 2 = IF([earlier day]=BLANK(),1,[clc1])
     
    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.