Forum Discussion
DateTime difference to previous date/time
I am trying to calculate the difference in minutes between the date/time values in my table, to end up with a new column called "Diff" like in the example below.
I looked at similar example but couldn't get these working due to extra fields being used whereas i'm hoping this is much simpler as its just one column with date and time in.
Can anyone show me what the DAX would be for this and if it should be a measure or calculated column?
Thanks
5 Replies
- FowmySuper User
rogerdea
Add the following DAX code in a new calculated column:Diff in Minutes = VAR __CURRTIME = 'Table1'[DateTime] VAR __LASTTIME = CALCULATE( MAX('Table1'[DateTime]), 'Table1'[DateTime]<__CURRTIME, REMOVEFILTERS('Table1') ) VAR __RESULT = DATEDIFF( __LASTTIME, __CURRTIME , MINUTE ) RETURN __RESULT - AnonymousNot applicable
Hi rogerdea ,
According to your descriptions, i guess you add a measure with Fowmy dax formula to table visual. if you want to show the date according to the filter, please add a new column to the original table, then add the datetime column to slicer visual.
Best regards,
Community Support Team_ Binbin Yu