Forum Discussion
Anonymous
7 years agoNot applicable
Calculate difference in minutes
I wanna know from the Datestamp coulmn see how much minute difference it's between the previous value and the last one. I tried this formula below but got totaly different value. Datediff = DAT...
hnguy71
Super User
7 years agoIs the column formatted as a Date type?
Anonymous
7 years agoNot applicable
^^
yes it is.
- hnguy717 years ago
Super User
Can you provide some sample data and your expected result?
- Anonymous7 years agoNot applicable
So that is that column, new data comes in every 5 min for each sensor and so on, but not alawys (sometime it drops or coming late) so I wanna make a new column to see how much it's difference between previous and the new datestamp by minutes.
- hnguy717 years ago
Super User
Try this:
In a calculated column:
TimeDiff = var _PreviousTime = CALCULATE(MAX(Table2[CommTimeStamp]), FILTER(Table2, EARLIER(Table2[CommTimeStamp]) > Table2[CommTimeStamp])) return IF(ISBLANK(_PreviousTime), 0, DATEDIFF(_PreviousTime, Table2[CommTimeStamp], MINUTE))