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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Grevatious
Frequent Visitor

Get the last delivery date

Hello everyone,

 

I need some help! I have two tables. The first one has all of the order description and client information and the other shows all the information regarding the delivery of each order. It is possible that each order has 2 or more Tracking Numbers with different delivery dates.

 

What I'm trying to do is to get the last delivery date from table 2 for each order of the table 1.

 

I have tried many times to no avail, so right I'm using the "Firstnoblank" formula, but this only returns the first value it finds instead of the last one by date.

 

Table 2:

Delivery Information
OrderTracking NumberDelivery Date
123100011/1/2020
124100022/1/2020
125100033/1/2020
126100044/1/2020
125100055/1/2020
123100066/1/2020

 

Table 1:

Orders
OrderLast Delivery Date
1236/1/2020
1242/1/2020
1255/1/2020
1264/1/2020

 

Thank you all!

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @Grevatious ,

 

Would you please refer to the following measure:

last delivery date =

CALCULATE (

    MAX ( 'Delivery Information'[Delivery Date] ),

    ALL ( 'Delivery Information' ),

    'Delivery Information'[Order] IN DISTINCT ( Orders[Order] )

)

Untitled picture.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

View solution in original post

4 REPLIES 4
PowerBIIE
Frequent Visitor

Hey - I want to use something like this for a calculated column. If I use this measure, it does not work correctly, how would I work around it?

v-deddai1-msft
Community Support
Community Support

Hi @Grevatious ,

 

Would you please refer to the following measure:

last delivery date =

CALCULATE (

    MAX ( 'Delivery Information'[Delivery Date] ),

    ALL ( 'Delivery Information' ),

    'Delivery Information'[Order] IN DISTINCT ( Orders[Order] )

)

Untitled picture.png

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@Grevatious ,

Use this measure in you table to display the date

 

 

Measure =
VAR __id = MAX( 'Table'[Orders] )
VAR __date = CALCULATE ( MAX( 'Table'[Delivery date] ), ALLSELECTED ( 'Table' ), 'Table'[Orders] = __id )
RETURN CALCULATE ( MAx ( 'Table'[Delivery date] ), VALUES ( 'Table'[Orders] ), 'Table'[Orders] = __id, 'Table'[Delivery date] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Greg_Deckler
Community Champion
Community Champion

Probably in Table1,

 

Last delivery date = MAXX(FILTER(RELATEDTABLE('Table2'),'Table2'[Order]=[Order]),[Delivery date])



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.