Forum Discussion

jaipal's avatar
jaipal
Resolver III
4 years ago
Solved

uptime

Hi professionals, I have data like this

I need %up time, %down time, uptime hours and downtime hours
Can someone give me ideas please.

 

Thanks.

  • jaipal's avatar
    jaipal
    4 years ago

    Hello ryan_mayu  here is the sample data. desired outcome is

    1. %up time

    2.%downtime

    3.up time hours

    4.downtime hours

     

    thank you

    NameDateTimeDurationStatus
    A1/10/2021 10:2959Up
    A1/10/2021 10:30478957Up
    A12/10/2021 22:453894Down
    A12/10/2021 23:50145046Up
    B1/10/2021 10:3037Up
    B1/10/2021 10:30479099Up
    B12/10/2021 22:414195Down
    B12/10/2021 23:51144955Up
    C11/10/2021 15:2337Up
    C11/10/2021 15:24112805Up
    C12/10/2021 22:443895Down
    C12/10/2021 23:49145159Up
    D11/10/2021 15:2437Up
    D11/10/2021 15:24112805Up
    D12/10/2021 22:443895Down
    D12/10/2021 23:49144943Up
  • Hi, jaipal 
    here goes your solution, if your Duration is in second:


    Four measures:

     

    Uptime = 1 - (SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]) / (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration])))
    
    Downtime = SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]) / (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration]))
    
    UptimeHours = (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration]))/60/60
    
    DowntimeHours = (SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]))/60/60

     

  • I am glad it's working, if you could Kudo my original message, so this threat is marked as Solved.
    jaipal Many thanks

     

10 Replies

  • jaipal , Create a new columns

     

    time in hour = datediff( [Datetime], maxx(filter(Table, [Name] = earlier([Name]) && [Datetime] < earlier([Datetime]) ),[Datetime]) , minute)/60

    Last Status = Var _max= maxx(filter(Table, [Name] = earlier([Name]) && [Datetime] < earlier([Datetime]) ),[Datetime])
    return
    maxx(filter(Table, [Name] = earlier([Name]) && [Datetime] =_max ),[status])

     

    Then create measures
    Uptime = sumx(filter(Table,[Last Status] ="Up"),[time in hour])

    Dwontime = sumx(filter(Table,[Last Status] ="Down"),[time in hour])

    0, [[Datetime]] )

    • jaipal's avatar
      jaipal
      Resolver III

      Hello amitchandak Amit, thank you for your reply, I just added duration to each event, now I needed 

      1. %up time

      2.%downtime

      3.up time hours

      4.downtime hours

       

      thanks in advance

      NameDateTimeDurationStatus
      A1/10/2021 10:2959Up
      A1/10/2021 10:30478957Up
      A12/10/2021 22:453894Down
      A12/10/2021 23:50145046Up
      B1/10/2021 10:3037Up
      B1/10/2021 10:30479099Up
      B12/10/2021 22:414195Down
      B12/10/2021 23:51144955Up
      C11/10/2021 15:2337Up
      C11/10/2021 15:24112805Up
      C12/10/2021 22:443895Down
      C12/10/2021 23:49145159Up
      D11/10/2021 15:2437Up
      D11/10/2021 15:24112805Up
      D12/10/2021 22:443895Down
      D12/10/2021 23:49144943Up
      • vojtechsima's avatar
        vojtechsima
        Super User

        I am glad it's working, if you could Kudo my original message, so this threat is marked as Solved.
        jaipal Many thanks

         
  • jaipal 

    could you pls provide the data in the table not the screenshot? What's more, pls provide the expected output based on your sample data.

    • jaipal's avatar
      jaipal
      Resolver III

      Hello ryan_mayu  here is the sample data. desired outcome is

      1. %up time

      2.%downtime

      3.up time hours

      4.downtime hours

       

      thank you

      NameDateTimeDurationStatus
      A1/10/2021 10:2959Up
      A1/10/2021 10:30478957Up
      A12/10/2021 22:453894Down
      A12/10/2021 23:50145046Up
      B1/10/2021 10:3037Up
      B1/10/2021 10:30479099Up
      B12/10/2021 22:414195Down
      B12/10/2021 23:51144955Up
      C11/10/2021 15:2337Up
      C11/10/2021 15:24112805Up
      C12/10/2021 22:443895Down
      C12/10/2021 23:49145159Up
      D11/10/2021 15:2437Up
      D11/10/2021 15:24112805Up
      D12/10/2021 22:443895Down
      D12/10/2021 23:49144943Up
      • vojtechsima's avatar
        vojtechsima
        Super User

        Hi, jaipal 
        here goes your solution, if your Duration is in second:


        Four measures:

         

        Uptime = 1 - (SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]) / (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration])))
        
        Downtime = SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]) / (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration]))
        
        UptimeHours = (SUMX(FILTER('Table','Table'[Status]="Up"),'Table'[Duration]))/60/60
        
        DowntimeHours = (SUMX(FILTER('Table','Table'[Status]="Down"),'Table'[Duration]))/60/60