Forum Discussion
Last Value
- 8 years ago
Hey, assuming your table looks like this
and you want to create a Calculated Column "PreviousDateTime" (Calculated Column means your are looking for DAX solution)
then this DAX statement finds the previous DATETTIME value in column "aDateTimeColumn":PreviousDateTime = var currentDateTime = 'FindPreviousDateTime'[aDateTimeColumn] return CALCULATE( MAXX( ALL('FindPreviousDateTime'[aDateTimeColumn]) ,IF('FindPreviousDateTime'[aDateTimeColumn] < currentDateTime, 'FindPreviousDateTime'[aDateTimeColumn], BLANK()) ) )Maybe you will think this code is a little to much, but beeing in a ROW Context of a table (we want to create a CALCULATED COLUMN), this helps to avoid the awkward message "... circular dependency ..." :-)
Hope this helps
Tom
Hey, assuming your table looks like this
and you want to create a Calculated Column "PreviousDateTime" (Calculated Column means your are looking for DAX solution)
then this DAX statement finds the previous DATETTIME value in column "aDateTimeColumn":
PreviousDateTime =
var currentDateTime = 'FindPreviousDateTime'[aDateTimeColumn]
return
CALCULATE(
MAXX(
ALL('FindPreviousDateTime'[aDateTimeColumn])
,IF('FindPreviousDateTime'[aDateTimeColumn] < currentDateTime, 'FindPreviousDateTime'[aDateTimeColumn], BLANK())
)
)Maybe you will think this code is a little to much, but beeing in a ROW Context of a table (we want to create a CALCULATED COLUMN), this helps to avoid the awkward message "... circular dependency ..." :-)
Hope this helps
Tom