Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create column with actual status

Hi everyone

I have a problem and I can not solve it.
I have a table like this:

I need to build a column calculated with the actual status, like this:

I am trying but probably I am doing something wrong.

Does someone help me?

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

     

    You want a Column in DAX or M? It's one in DAX

    Actual = 
    VAR CurP = yourTable[Product]
    VAR MaxDate = MAXX(FILTER(yourTable,yourTable[Product]=CurP),[Date])
    RETURN
    MAXX(FILTER(ALLEXCEPT(yourTable,yourTable[Product]),yourTable[Date]=MaxDate),yourTable[Status])

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    You want a Column in DAX or M? It's one in DAX

    Actual = 
    VAR CurP = yourTable[Product]
    VAR MaxDate = MAXX(FILTER(yourTable,yourTable[Product]=CurP),[Date])
    RETURN
    MAXX(FILTER(ALLEXCEPT(yourTable,yourTable[Product]),yourTable[Date]=MaxDate),yourTable[Status])