Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I have the following data:
| ID | Date |
| 01 | 4/5/2020 |
| 01 | null |
| 02 | 1/6/2021 |
| 03 | 2/3/2021 |
I want to create a second column Date2 that states the max date for each ID, like so:
| ID | Date | Date2 |
| 01 | 4/5/2020 | null |
| 01 | 1/1/9999 | null |
| 02 | 1/6/2021 | 1/6/2021 |
| 03 | 2/3/2021 | 2/3/2021 |
Is there a solution for this that doesn't involve Group By? To elaborate, my current method for doing this is:
But I'm not really a fan of this rudimentary technique because it involves so many steps. Does a simpler, formula-based solution exist?
Solved! Go to Solution.
Try this calculated column (DAX):
Date2 =
VAR vMaxDateNoBlank =
CALCULATE ( MAX ( Table1[Date] ), ALLEXCEPT ( Table1, Table1[ID] ) )
VAR vRowCountWithBlank =
CALCULATE (
COUNTROWS ( Table1 ),
ALLEXCEPT ( Table1, Table1[ID] ),
ISBLANK ( Table1[Date] )
)
VAR vResult =
IF ( vRowCountWithBlank > 0, BLANK (), vMaxDateNoBlank )
RETURN
vResult
Proud to be a Super User!
Hi @bleow ,
You can create a measure as below to get it:
Date2 =
VAR _count =
COUNTX (
FILTER (
ALLSELECTED( 'Table' ),
'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] )
&& ISBLANK ( 'Table'[Date] )
),
[ID]
)
RETURN
IF (
_count > 0,
BLANK (),
CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
)
Best Regards
Try this calculated column (DAX):
Date2 =
VAR vMaxDateNoBlank =
CALCULATE ( MAX ( Table1[Date] ), ALLEXCEPT ( Table1, Table1[ID] ) )
VAR vRowCountWithBlank =
CALCULATE (
COUNTROWS ( Table1 ),
ALLEXCEPT ( Table1, Table1[ID] ),
ISBLANK ( Table1[Date] )
)
VAR vResult =
IF ( vRowCountWithBlank > 0, BLANK (), vMaxDateNoBlank )
RETURN
vResult
Proud to be a Super User!