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...
Anonymous
7 years agoNot applicable
^^
yes it is.
hnguy71
Super User
7 years agoCan 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))
- Anonymous7 years agoNot applicable
I get this error:
The syntax for 'DATEDIFF' is incorrect. (DAX(var _PreviousTime = CALCULATE(MAX(DataView[CommTimeStamp]), FILTER(DataView, EARLIER(DataView[CommTimeStamp]) > DataView[CommTimeStamp]))returnIF(ISBLANK(_PreviousTime), 0. DATEDIFF(_PreviousTime, DataView[CommTimeStamp], MINUTE)))).