Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION
Mariusz
Community Champion
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

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
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
Not applicable

Thank you very much! It works.

Now i have to find out how 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.