Forum Discussion
Determining Previous Status in Table with Same ID
- Anonymous4 years ago
Hi Alex215 ,
The value of the date column is not unique, please first create a new index column.
Please create a new calculated column.
Past Status = VAR _index = CALCULATE ( MIN ( 'Table'[Index] ), FILTER ( 'Table', 'Table'[Index] >= EARLIER ( 'Table'[Index] ) && 'Table'[Field] = "status" && 'Table'[id] = EARLIER('Table'[id]) ) ) VAR _status = CALCULATE ( MAX ( 'Table'[OldValue] ), FILTER ( 'Table', 'Table'[Index] = _index ) ) RETURN _statusAttach the PBIX file for reference. Hope it helps.
Best Regards,
Community Support Team_GaoIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi Alex215 ,
The value of the date column is not unique, please first create a new index column.
Please create a new calculated column.
Past Status =
VAR _index =
CALCULATE (
MIN ( 'Table'[Index] ),
FILTER (
'Table',
'Table'[Index] >= EARLIER ( 'Table'[Index] )
&& 'Table'[Field] = "status"
&& 'Table'[id] = EARLIER('Table'[id])
)
)
VAR _status =
CALCULATE (
MAX ( 'Table'[OldValue] ),
FILTER ( 'Table', 'Table'[Index] = _index )
)
RETURN
_status
Attach the PBIX file for reference. Hope it helps.
Best Regards,
Community Support Team_Gao
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems with it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Hi Anonymous,
Thank you for that information. That worked! I do not use DAX very much so I never even thought to approach the problem that way.
I appreciate all your help!