Forum Discussion

Faber13's avatar
Faber13
Helper II
4 years ago

accumulated

Hey guys, I need to calculate the accumulated number of days in which the equipment is stopped, when it is ok it is not to calculate, in this first case it is for the result to be 3, if I filter to another period it is to be 2.

 

dataCodigoStatus    
22/08/20226586OK    
23/08/20229950Parado    
24/08/20226586OK    
25/08/20229950Parado    
26/08/20226586OKFilter Case 2 Acumulado CASO 1Acumulado CASO 2
27/08/20229950OK  32
28/08/20226586OK    
29/08/20229950Parado    
30/08/20226586OK    
31/08/20229950Parado    
01/09/20226586OK    
02/09/20229950ParadoFilter Case 1   

2 Replies

  • v-yadongf-msft's avatar
    v-yadongf-msft
    Community Support

    Hi Faber13,

     

    Please try following DAX to create a new column:

    Column = 
    VAR cur_today = TODAY()
    VAR accumulated_days = IF([Status] = "OK",BLANK(),DATEDIFF([date],cur_today,DAY))
    RETURN
    accumulated_days
    

     

    Then you can calculate the accumulated number of days in which the equipment is stopped:

     

    If I misunderstand your demands, please feel free to contact us in time.

     

    Best regards,

    Yadong Fang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Faber13's avatar
      Faber13
      Helper II

      Hi v-yadongf-msft , unfortunately it didn't work my friend, it was to give the results to the below (1,2) (1,2,3,4)