Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Find last text value for groups by date

Hi all

 

I have table like this:

indexIDto stageend dateLast Stage
1aaanew7/1/2019Complete
2aaasubmitted7/1/2019Complete
3aaasolutioning7/3/2019Complete
4aaaaccepted7/5/2019Complete
5aaaComplete7/6/2019Complete
6bbbnew7/10/2019Cancelled
7bbbsubmitted7/11/2019Cancelled
8bbbsolutioning7/13/2019Cancelled
9bbbCancelled7/13/2019Cancelled
10cccnew7/20/2019solutioning
11cccsubmitted7/21/2019solutioning
12cccsolutioning7/22/2019solutioning

 

I need a new calculated column Last Stage with information of ID's groups last stage.

Can someone help me with this?

Thank You.

  • Hi Anonymous 

     

    The below DAX expression should return the desired result.

     

    Last Stage = 
    VAR _lastIndex = CALCULATE( 
        MAX( 'Table'[index] ), 
        ALLEXCEPT( 'Table', 'Table'[ID] )
    )
    RETURN CALCULATE( 
        SELECTEDVALUE( 'Table'[to stage] ), 
        ALL( 'Table' ),
        'Table'[index] = _lastIndex 
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

2 Replies

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

     

    The below DAX expression should return the desired result.

     

    Last Stage = 
    VAR _lastIndex = CALCULATE( 
        MAX( 'Table'[index] ), 
        ALLEXCEPT( 'Table', 'Table'[ID] )
    )
    RETURN CALCULATE( 
        SELECTEDVALUE( 'Table'[to stage] ), 
        ALL( 'Table' ),
        'Table'[index] = _lastIndex 
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much! It works.

      Now i have to find out how :)