Forum Discussion
Difference between dates on different rows and same column AFTER filtering
- 3 years ago
hi leodm
try to add plot all the columns with a measure like:
Result = VAR _date = MAX(TableName[Date]) VAR _datepre = MAXX( FILTER( ALLSELECTED(TableName), TableName[Date]<_date ), TableName[Date] ) VAR _Difference= _date - _datepre VAR _Days = INT(_Difference) VAR _Hours = HOUR(_Difference) VAR _Minutes = MINUTE(_Difference) VAR _Seconds = SECOND(_Difference) VAR _DaysToHours = _Days * 24 VAR _TotalHours = _DaysToHours + _Hours RETURN IF( _datepre<>BLANK(), FORMAT(_TotalHours, "00") & ":" & FORMAT(_Minutes, "00") & ":" & FORMAT(_Seconds,"00"), " " )it worked like:
hi leodm
try to add plot all the columns with a measure like:
Result =
VAR _date = MAX(TableName[Date])
VAR _datepre =
MAXX(
FILTER(
ALLSELECTED(TableName),
TableName[Date]<_date
),
TableName[Date]
)
VAR _Difference= _date - _datepre
VAR _Days = INT(_Difference)
VAR _Hours = HOUR(_Difference)
VAR _Minutes = MINUTE(_Difference)
VAR _Seconds = SECOND(_Difference)
VAR _DaysToHours = _Days * 24
VAR _TotalHours = _DaysToHours + _Hours
RETURN
IF(
_datepre<>BLANK(),
FORMAT(_TotalHours, "00") & ":" & FORMAT(_Minutes, "00") & ":" & FORMAT(_Seconds,"00"),
" "
)
it worked like:
Hi FreemanZ thanks for you answer,
I was able to get correct results with your provided Measure, awesome!
The only thing I couldn't do is show it in a graph. Is it because graphs can't display time like that? How could I use these results to show days & hours in graphs? Thank you.
- FreemanZ3 years agoSuper User
hi leodm
because the result of the measure is text, to plot graphically, try to return _Difference directly.
- leodm3 years agoFrequent Visitor
Hi FreemanZ
I tried outputting the Result in hours just to generate a graph:
The values are correct on the table, but for some reason the graph only shows the last value of the month.
I need one graph to show the AVERAGE and another one to show the TOTAL within a certain period. Could you help me with this one?