Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Paknanarn23
Creator II
Creator II

I want to calculate down time

I'm having a problem with the Down Time calculation, which is causing too many calculations.

Now I use this formula to calculate Downtime which is the formula used to calculate down time for every report.

Paknanarn23_0-1676004778924.png


But instead, there is a problem that the Start time and Finish time are skipped, causing too much Down time. What should I do?

2023_02_10_11_54_30_10.10.99.155_Remote_Desktop_Connection.png


This is the expression used to find Downtime.

Paknanarn23_1-1676004961880.png

 

1 Solution

Accepted Solutions
Vegar
MVP
MVP

It looks like you are calculating downtime by subtracting the start time from the end time.

 

This will work as long you're in the same date, but intervals that ends after midnight will give you issues.

You can solve this by using the start and end timestamps instead of time if you have them available . If not then you could make an assumption  that all end times that are less than start time are timea the next day. Then you could do something like this 

=If (FinishMachine < StartMachine, 

(FinishMachine+1) - StartMachine,

FinishMachine - StartMachine)

The +1 adds a day (24 hours) to your time making the subtraction correct.

View solution in original post

4 Replies
Vegar
MVP
MVP

It looks like you are calculating downtime by subtracting the start time from the end time.

 

This will work as long you're in the same date, but intervals that ends after midnight will give you issues.

You can solve this by using the start and end timestamps instead of time if you have them available . If not then you could make an assumption  that all end times that are less than start time are timea the next day. Then you could do something like this 

=If (FinishMachine < StartMachine, 

(FinishMachine+1) - StartMachine,

FinishMachine - StartMachine)

The +1 adds a day (24 hours) to your time making the subtraction correct.

Paknanarn23
Creator II
Creator II
Author

What you gave it doesn't solve my problem. Because I can't even know the finish time. when will it finish

Vegar
MVP
MVP

I'm sorry about  that. I interpreted your upper left red square marking in the table image as two values that you had access to (StartMachine and FinishMachine).

Paknanarn23
Creator II
Creator II
Author

It was time for a downtime error. because the time it started and finished that skips the day causing the downtime it's too much