cancel
Showing results 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.

Helper III

## DAX to return the corresponding value of a max date

Hi, I have a table that looks like this:

 Order ID Link ID Order Date Order Status 101 5016 6/17/2019 Y 102 5016 4/20/2022 N 103 5016 7/23/2018 Y 111 5014 5/5/2020 N 112 5014 1/4/2021 Y

Each Link ID can have multiple Order ID's. What I'm trying to do is look up Orders based on the Link ID, and return the Max of Order Date, and that Max Order Date's corresponding Order Status. Like Below (Link Date and Link Status):

 Order ID Link ID Order Date Order Status Link Date Link Status 101 5016 6/17/2019 Y 4/20/2022 N 102 5016 4/20/2022 N 4/20/2022 N 103 5016 7/23/2018 Y 4/20/2022 N 111 5014 5/5/2020 N 1/4/2021 Y 112 5014 1/4/2021 Y 1/4/2021 Y

I was able to work out the Link Date DAX formula, but I'm unable to fetch it's corresponding Link Status.

``````CALCULATE(
MAX(Table[Order Date]),
)``````

How do I get the corresponding Order Status for the Link Date?

Any help is appreciated.

Edit: I goofed up the formatting, but here's a clearer picture

1 ACCEPTED SOLUTION
Super User

@RustyNails Try:

``````Link Status =
CALCULATE(
MAX(Table[Order Date]),
)
RETURN

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
2 REPLIES 2
Super User

@RustyNails Try:

``````Link Status =
CALCULATE(
MAX(Table[Order Date]),
)
RETURN

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Helper III

You're a genius. Thank you for the quick response!!!

Announcements

#### 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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors