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
Anonymous
Not applicable

Max Date Relative To Job Number

I have 3 Tables:

 

Table 1 - List of Unique Job Numbers

Tabel 2 - List of Job Numbers With Original Planned Date

Table 3 - List of Job Numbers With Current Planned Date (Multiple Entries Per Job Number)

 

Table 1

Job Number
Job 1
Job 2
Job 3

 

 

Table 2

Job NumberOriginal Planned Date
Job 101/01/2020
Job 201/02/2020
Job 301/03/2020

 

 

Table 3

Job NumberCurrent Planned Date
Job 106/01/2020
Job 107/01/2020
Job 202/02/2020
Job 204/02/2020
Job 208/02/2020
Job 301/03/2020
Job 308/03/2020

 

What I need to end up with is a new table with the following Job Number, Original Planned Date, the latest Current Planned Date, and a column showing slip:

 

Table 4

Job NumberOriginal Planned DateCurrent Planned DateSlip
Job 101/01/202007/01/20206
Job 201/02/202008/02/20207
Job 301/03/202008/03/20207

 

Any help that people can give will be greatly appreciated.

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

If you have created the relationship among these tables by [Job number] column?

https://docs.microsoft.com/en-us/power-bi/desktop-create-and-manage-relationships

If yese, you could use this formula to create a new table:

Table 4 = 
SUMMARIZE (
    'Table 1',
    'Table 1'[Job Number],
    "Original Planned Date", CALCULATE ( MAX ( 'Table 2'[Original Planned Date] ) ),
    "Current Planned Date", CALCULATE ( MAX ( 'Table 3'[Current Planned Date] ) ),
    "Slip", DATEDIFF (
        CALCULATE ( MAX ( 'Table 2'[Original Planned Date] ) ),
        CALCULATE ( MAX ( 'Table 3'[Current Planned Date] ) ),
        DAY
    )
)

If no, you could use this formula to create a new table

Table 5 = 
SUMMARIZE (
    'Table 1',
    'Table 1'[Job Number],
    "Original Planned Date", CALCULATE (
        MAX ( 'Table 2'[Original Planned Date] ),
        FILTER ( 'Table 2', 'Table 2'[Job Number] = 'Table 1'[Job Number] )
    ),
    "Current Planned Date", CALCULATE (
        MAX ( 'Table 3'[Current Planned Date] ),
        FILTER ( 'Table 3', 'Table 3'[Job Number] = 'Table 1'[Job Number] )
    ),
    "Slip", DATEDIFF (
        CALCULATE (
            MAX ( 'Table 2'[Original Planned Date] ),
            FILTER ( 'Table 2', 'Table 2'[Job Number] = 'Table 1'[Job Number] )
        ),
        CALCULATE (
            MAX ( 'Table 3'[Current Planned Date] ),
            FILTER ( 'Table 3', 'Table 3'[Job Number] = 'Table 1'[Job Number] )
        ),
        DAY
    )
)

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for your reply, I have tried the first example you provided which is nearly what I want but doesn't give quite the right result.

 

In "Table 4" the "Current Planned Date" column retruns the same vale for every job number rather than the max date relative to that job.

 

Do you know how I could change this?

hi  @Anonymous 

Do you create a relationship between table1 and table3 by job number column as below?

10.JPG

 

and also try this formula:

Table 6 = 
SUMMARIZE (
    'Table 1',
    'Table 1'[Job Number],
    "Original Planned Date", MAXX(RELATEDTABLE('Table 2'),[Original Planned Date]),
    "Current Planned Date", MAXX(RELATEDTABLE('Table 3'),[Current Planned Date]),
    "Slip", DATEDIFF (
        MAXX(RELATEDTABLE('Table 2'),[Original Planned Date]),
        MAXX(RELATEDTABLE('Table 3'),[Current Planned Date]),
        DAY
    )
)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous ,Assuming table 1 is Job master. try like

Table 4 =
summarize(Table1, table[job],table2[Original Planned Date], "Current Planned Date",max(Table3[Current Planned Date]),"Slip",
datediff(min(Table3[Current Planned Date]),max(Table3[Current Planned Date]),day))

 

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

This will get you the MAX Current Planned Date: https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814



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...
Anonymous
Not applicable

Greg,

 

Thanks for your help, sorry to be a pain but with my limted knowledge i'm not sure to to impliment this to get the final result i'm after.

 

Could you explain a bit futher or show how it would be applied relative to the examples tables I gave please.

 

Best Regards


Alex

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.