Forum Discussion
joshua1990
Post Prodigy
5 years agoDetermine Last State
Hello everyone! I would like to determine the last tracked status within a specific systematic. So, I have this table: Date Requested Item Type1 Type2 Value State Date Finished Order ...
stevedep
Memorable Member
5 years agoHi,
The below code should do the trick.
___GetLastState =
var _maxdate = CALCULATE(MAX('Table'[Date Requested]), FILTER(ALL('Table'), 'Table'[Item] = SELECTEDVALUE('Table'[Item]) && 'Table'[Type1] = 6 && 'Table'[Type2] = "AC" ))
return
CALCULATE(MAX('Table'[State]), FILTER(ALL('Table'), 'Table'[Item] = SELECTEDVALUE('Table'[Item]) && 'Table'[Date Requested] = _maxdate))
Link to the file here.
I recorded a video while creating the measure, hopefully, this helps in building an understanding of how to approach such a challenge.
Please accept as a solution if so. Thumbs up for the effort is appreciated.
Kind regards,
Steve.