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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
_Kelz0484
Frequent Visitor

Latest date with a clause

Hi,

Bit of an odd one! I have a dataset which includes 2 x date columns, 'test date' and 'concessed date' I would like to create a new column called 'master date' which looks at the other 2 columns and gives the furthest date in the future. But there is a clause, there could be blanks in either column and in most instances where there is a date in both columns the concessed date is furthest in the future. But I have found a couple of instances where the test date and concessed date are populated and the concessed date is earlier, if this happens I need the earlier concessed date to be master instead.

 

I guess the easiest way to put it, master date to be the furthest date in the future unless concessed date comes first. Some sample data below.

 

Screenshot_20250129_105446_Email.jpg

1 ACCEPTED SOLUTION

@_Kelz0484 

 

SWITCH (
    TRUE (),
    ISBLANK ( 'Table'[Concessed Date] ) && ISBLANK ( 'Table'[Test Date] ), TODAY(),
    ISBLANK ( 'Table'[Concessed Date] ), 'Table'[Test Date],
    ISBLANK ( 'Table'[Test Date] ), 'Table'[Concessed Date],
    'Table'[Concessed Date] < 'Table'[Test Date], 'Table'[Concessed Date],
    MAX ( 'Table'[Test Date], 'Table'[Concessed Date] )
)

 

If this now works, please accept as the solution for others with the same challenge.

View solution in original post

6 REPLIES 6
mark_endicott
Super User
Super User

@_Kelz0484 - Try this as a calculated column:

 

MAX( Table[Test Date], Table[Concessed Date] )

 

It will ignore blanks and always give you the latest date from both columns.

 

If this works, please accept as the solution for others with the same challenge.

Hi, this is similar to what I am already using and yes it works for giving me the latest date but it doesn't help with the odd instances where the earlier concessed date is found.

Thanks!

@_Kelz0484 - Sorry I misread your requirement the below will now work:

 

SWITCH (
    TRUE (),
    ISBLANK ( 'Table'[Concessed Date] ), 'Table'[Test Date],
    ISBLANK ( 'Table'[Test Date] ), 'Table'[Concessed Date],
    'Table'[Concessed Date] < 'Table'[Test Date], 'Table'[Concessed Date],
    MAX ( 'Table'[Test Date], 'Table'[Concessed Date] )
)

 

mark_endicott_0-1738164069217.png

 

If this now works, please accept as the solution for others with the same challenge.

That is perfect but now I've noticed that I have a lot of entries where both dates are blank. How would I populated these with today's date. I thought it would simply adding TODAY() as the final result but that didn't work.

@_Kelz0484 

 

SWITCH (
    TRUE (),
    ISBLANK ( 'Table'[Concessed Date] ) && ISBLANK ( 'Table'[Test Date] ), TODAY(),
    ISBLANK ( 'Table'[Concessed Date] ), 'Table'[Test Date],
    ISBLANK ( 'Table'[Test Date] ), 'Table'[Concessed Date],
    'Table'[Concessed Date] < 'Table'[Test Date], 'Table'[Concessed Date],
    MAX ( 'Table'[Test Date], 'Table'[Concessed Date] )
)

 

If this now works, please accept as the solution for others with the same challenge.

Hi mark_endicott

That's perfect - exactly what I was looking for!

Thanks so much for your help.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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