Forum Discussion
rnehrboss
Helper II
4 years agoCreating a last maximum? calculation
I'd like to create a measure that looks through last records finds the local max (100 in this example) and then uses the time and battery level from that record, along with the most recent local min ...
rnehrboss
Helper II
4 years agoThanks Ryan!
I think you are close to the right solution. One thing I didn't include (sorry) is that I have a column with devices. So I think the "status" column is calculating based on all reported device percentages instead of grouping and calculating. Is it possible to have the "status" column calculate on groupings?
ryan_mayu
Super User
4 years agopls try this
status =
VAR _last = maxx(FILTER('Table','Table'[create_time]<EARLIER('Table'[create_time])&&'Table'[DeviceID]=EARLIER('Table'[DeviceID])),'Table'[create_time])
var _lastvalue= maxx(FILTER('Table','Table'[create_time]=_last),'Table'[Battery])
return if(_lastvalue<'Table'[Battery],"charging","discharging")