Forum Discussion
Anonymous
6 years agoNot applicable
Calculating time difference between rows with slicers
I have a DAX formula that is calculating the time difference between each consecutive row in a table visulaization. It works when I have only one process selected, but when I select multiple processe...
- 6 years ago
It looks like it is correctly calculating the difference between rows (regardless of the Process). If you'd like to keep the Process in context, you need to add VALUES('Main Table'[Process]) to your Calculate().
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
Anonymous
6 years agoNot applicable
Hi Anonymous ,
Incase you want difference between each row
Time Difference =
var _a = MAX('Table'[Date/Time])
var _previousdate = CALCULATE(MAX('Table'[Date/Time]), FILTER(ALLSELECTED('Table'[Date/Time]),'Table'[Date/Time] < _a) )
RETURN
CALCULATE(DATEDIFF(_previousdate,_a,MINUTE))
This measure too gives the same results.
Time Difference =
VAR _a =
MAX ( 'Table'[Date/Time] )
VAR _previousdate =
CALCULATE (
MAX ( 'Table'[Date/Time] ),
FILTER (
ALLEXCEPT('Table', 'Table'[Process])
,
'Table'[Date/Time] < _a
)
)
RETURN
DATEDIFF (
_previousdate,
_a,
MINUTE
)
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)