Forum Discussion
ericsara
Helper I
4 years agoSum days based on status
Hello, wonderful world of Power BI. Hoping you can help me with this one. We have a ticketing system where a ticket can move from one status to another. As it does, the date it moved is recorded. T...
- 4 years ago
ericsara , a new column
datediff([Date], minx(filter(table, [Date] > earlier([Date]) ),[Date]),day)
- 4 years ago
In your instance for development "24/5/00 to 29/5/22 (5 Days) + the difference between 31/05/22 to 7/6/22 (7 Days)." in which total is 12 days not 11.
In your solution you missed the duplicate date scenario , Admin and support both got on same date 08/05/2022.
The improved calculated column is shown below:
First add index column start from 1 in power query
Then
Column =
DATEDIFF (
'Table'[Date],
MINX (
FILTER (
'Table',
'Table'[Date] >= EARLIER ( 'Table'[Date] )
&& 'Table'[Index] > EARLIER ( 'Table'[Index] )
),
'Table'[Date]
),
DAY
)
ericsara
Helper I
4 years agoThanks ddpl and amitchandak
I have been playing with this and wonder if you would expect it to still work with a data set such as this.
| Date | Status | Ticket |
| 2/05/2022 | Open | 1 |
| 4/05/2022 | Support | 1 |
| 8/05/2022 | Admin | 1 |
| 8/05/2022 | Support | 1 |
| 24/05/2022 | Development | 1 |
| 29/05/2022 | Support | 1 |
| 31/05/2022 | Development | 1 |
| 7/06/2022 | Support | 1 |
| 10/06/2022 | Closed | 1 |
| 2/05/2022 | Open | 2 |
| 5/05/2022 | Support | 2 |
| 8/05/2022 | Admin | 2 |
| 8/05/2022 | Support | 2 |
| 24/05/2022 | Development | 2 |
| 29/05/2022 | Support | 2 |
| 2/06/2022 | Development | 2 |
| 10/06/2022 | Closed | 2 |
In this example I want the number of days between statuses to be realted to the ticket number.