Forum Discussion
areias_br
Helper I
1 year agoPersonalized Collum based on the next row value
Hi, I have a table with the following colluns: Date | Hour | OperationCode | ID Whenever I have a change in a operation, a new line is created with the record of the hour that operation st...
- 1 year ago
you can try this
datehour = 'Table'[Date]+'Table'[Hour]Column =VAR _next=MINX(FILTER('Table','Table'[datehour]>EARLIER('Table'[datehour])),'Table'[datehour])var _hour=maxx(FILTER('Table','Table'[datehour]=_next),'Table'[Hour])return if (ISBLANK(_hour),blank(), if ('Table'[Hour]>_hour, DATEDIFF((date(2020,1,1)+'Table'[Hour]),(date(2020,1,2)+_hour),MINUTE),DATEDIFF((date(2020,1,1)+'Table'[Hour]),(date(2020,1,1)+_hour),MINUTE)))
areias_br
Helper I
1 year ago02/08/2024 | 13:50 | Navigation | 1 | 580 minutes (23:30 - 13:50 = 09:40 => 09*60 + 40)
02/08/2024 | 23:30 | Mooring | 2 | 15 minutes (23:45 - 23:30 = 15)
02/08/2024 | 23:45 | Moored | 3 | ...
I've changed the last value because it gets a little bit more complicated when day changes.
ryan_mayu
Super User
1 year agoyou can try this
datehour = 'Table'[Date]+'Table'[Hour]
Column =
VAR _next=MINX(FILTER('Table','Table'[datehour]>EARLIER('Table'[datehour])),'Table'[datehour])
var _hour=maxx(FILTER('Table','Table'[datehour]=_next),'Table'[Hour])
return if (ISBLANK(_hour),blank(), if ('Table'[Hour]>_hour, DATEDIFF((date(2020,1,1)+'Table'[Hour]),(date(2020,1,2)+_hour),MINUTE),DATEDIFF((date(2020,1,1)+'Table'[Hour]),(date(2020,1,1)+_hour),MINUTE)))