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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
mircea
Helper I
Helper I

Calculate maximum date independent of filters

Hello,

 

I am new to DAX calculations.

I know that I can calculate the maximum [Date1] independent of filters like this:

[MAX Date] =
 CALCULATE(
    MAX( MyTable[Date1] ),
    ALL( 'MyTable' )
)

My problem is that I have 4 different date columns [Date1], [Date2], [Date3], [Date4] and I want to return the maximum date among them. Note that any filter must be ignored.

 

Please advise.

Regards

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

Without unpivoting your date column, I can't think of a way around calculating each separately and then finding the maximum among the maximums.

 

MAX Date =
VAR Max1 = CALCULATE ( MAX ( MyTable[Date1] ), ALL ( 'MyTable' ) )
VAR Max2 = CALCULATE ( MAX ( MyTable[Date2] ), ALL ( 'MyTable' ) )
VAR Max3 = CALCULATE ( MAX ( MyTable[Date3] ), ALL ( 'MyTable' ) )
VAR Max4 = CALCULATE ( MAX ( MyTable[Date4] ), ALL ( 'MyTable' ) )
RETURN
    MAX ( MAX ( Max1, Max2 ), MAX ( Max3, Max4 ) )

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Without unpivoting your date column, I can't think of a way around calculating each separately and then finding the maximum among the maximums.

 

MAX Date =
VAR Max1 = CALCULATE ( MAX ( MyTable[Date1] ), ALL ( 'MyTable' ) )
VAR Max2 = CALCULATE ( MAX ( MyTable[Date2] ), ALL ( 'MyTable' ) )
VAR Max3 = CALCULATE ( MAX ( MyTable[Date3] ), ALL ( 'MyTable' ) )
VAR Max4 = CALCULATE ( MAX ( MyTable[Date4] ), ALL ( 'MyTable' ) )
RETURN
    MAX ( MAX ( Max1, Max2 ), MAX ( Max3, Max4 ) )

Thank you Alexis for your quick help!

Helpful resources

Announcements
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.