Forum Discussion
How to calculate average duration every few rows
I have a table like this:
| app_name | env | deploy_date | dt_diff | what_i_need |
| application1 | dev | 09/03/2021 17:13:36 | null | 6 |
| application1 | dev | 19/03/2021 18:35:07 | 10.01:21:31 | 6 |
| application1 | dev | 22/03/2021 11:59:50 | 2.17:24:43 | 6 |
| application1 | uat | 24/08/2021 16:01:20 | null | 2 |
| application1 | uat | 24/08/2021 16:08:34 | 2.00:07:14 | 2 |
| application1 | prd | 06/04/2021 18:10:24 | null | 0 |
| application2 | dev | 22/03/2021 13:33:50 | null | 0 |
| application2 | uat | 11/12/2020 19:14:30 | null | 0 |
| application2 | prd | 09/04/2021 21:57:49 | null | 0 |
I need the avarage of dt_diff per application and environment:
In the example above the application1 was deployed three times to the dev environment, the interval between the deploys is shown in the dt_diff and the avarage should be a sum of the dt_diff, divided by the number of dt_diff for that specific combination of application and enviornment.
- Anonymous4 years ago
Found the solution reading this article: https://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586#:~:text=MTBF%20(Hours)%20%3D%20DIVIDE(,%2B%20%5BMTBF%20(Hours)%5D%2F24
3 Replies
- parry2k
Super User
Anonymous when you say the sum of date_diff, seems like it is a time, what unit do you want to sum this up to (hour/minute/second)?
✨ Follow us on LinkedIn and to our YouTube channel
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
- AnonymousNot applicable
dt_diff in the Query Editor is a column of type Duration, but in the Power BI is of type Decimal
Preferably I would like this to be in Days, the next best thing would be Hours
- AnonymousNot applicable