Forum Discussion
Duration Since Previous Entries
Hello,
I have the below table and would like to calculate the time difference (duration) between each [Date/Time Stamp] in chronological order. I would like to achieve that in two forms:
D1. Duration calculated between each row, independent of the [Modified by]
D2. Duration since the previous entry with the same [Modified by] (last entry for each [Modified by] can be "0" or "null" / ignored if needed)
The File column has different values further down in the data and ideally I would like to be able to use that as a filter or colour code in different visuals later on.
I had a look through the forum, but I have also only limited understanding of the complexer capabilities of PowerBI (I consider myself a novice) and a very simple explanation or approach would be very welcome.
Much appreciated and thanks in advance.
2 Replies
- Greg_DecklerCommunity Champion
philipplammers See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous- philipplammersRegular Visitor
Greg_Deckler many thanks for the very quick reply. Your post about MTBF describes pretty much what I want to achieve though I am struggling to apply it (as I said, I am newbie to this).
First issue, when I paste your code example, I get the error message "Token Eof expected" - and that is where my knowledge already ends. I don't even know what that means.
Would the next step be to replace the [Date] & [Value] with my [Date/ Time Stamp]?