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
Hoping
Helper III
Helper III

Max of date columns

I have 5 date columns in a table.

 

I would like to create a new column that shows the max of these 5 date columns.

 

Some of the rows could have null values for any or all of these dates. I want to perform a "max" ignoring teh null values.

 

If all 5 columns for a row are null, then maybe I would turn it into 31st December 9999.

 

Doing a List.Max on null values is causing an error.

 

How can this be acheived?

1 REPLY 1
edhans
Super User
Super User

List.Max has no issues with nulls. My "Custom" column is finding the Max date from the 4 date columns, some with null.

edhans_0-1688576665106.png

If you don't have nulls, where null is shown, those are empty, or "", you can filter that out with List.Select first. This does that:

 

                List.Max(
                    List.Select(
                        Record.ToList(
                            Record.SelectFields(_, {"Date1", "Date2", "Date3", "Date4"})
                        ), 
                        each _ <> ""
                    )
                )

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.