How to apply case when Calculation?

I have one table like following:
Time, Event, Value
123456, A, 0
234556, B, 1
123456, C, 2

There are some business logic like:
if A=0 and B=0
then ‘StatusA’
if A=0 and B=1
then ‘StatusB’

Based on the current table structure I am not sure how to do that.
the difficult part is it not always the exactly timestamp when A and B both occurred.
It looks like I need to use FLUX Query to do some pivot calculation and need to fill(previous) if the timestamp for A and B are not exact match.
I am not sure I am on the right direction.
Any suggestion will be appreciated