Join 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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi there,
Wondering if anyone has attempted this before. I'm trying to find max date per group, second max date and then third.
I'm okay with getting max and second to that by using the following:
The calculation to find max date per group:
Solved! Go to Solution.
Hey @kasiaw29 ,
if that worked, then you can just repeat it:
3rd Latest Date =
CALCULATE(
MAX( 'Table'[Date] ),
ALLEXCEPT( 'Table', 'Table'[ID] ),
'Table'[Date] <> [Latest Date] && 'Table'[Date] <> [2nd Latest Date]
)
@kasiaw29 I'm thinking that you should do something like:
Measure =
VAR __Table = ADDCOLUMNS('Query1',"__Rank",RANKX('Query1',[Date],,DESC))
RETURN
MAXX(FILTER(__Table,[__Rank] = 3),[Date])
Hey @kasiaw29 ,
if that worked, then you can just repeat it:
3rd Latest Date =
CALCULATE(
MAX( 'Table'[Date] ),
ALLEXCEPT( 'Table', 'Table'[ID] ),
'Table'[Date] <> [Latest Date] && 'Table'[Date] <> [2nd Latest Date]
)
Should have thought of that! Magic, worked perfectly!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.