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

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.

Reply
deng2431
Helper I
Helper I

DAX - help with last date based on multiple distinct keys

Hi PowerBi community,

 

I am new to Powerbi and DAX, I am trying to solve an issue of selecting the MAX/Last date from a column (payment date) where there were multiple same numbers (Invoice Key column). if there is no multiple keys then just display the 1 payment date. i get the concept of what needs to be done but i just cant get my head wrapped around how to partition the distinct invoice keys and then use that to find the max/last date from that partition. any help or advice is really appreciated. thank you!!

 

a4f207c1-230e-457d-9113-36c336a27f95.png

 

1 ACCEPTED SOLUTION
deng2431
Helper I
Helper I

Hi Magnus,

 

Thank you for your response, i just so happen to came across a solution to my issues earlier using the below query:

 

Payment date (Final) = calculate(max(Payments[Payment date]),  allexcept(Payments, 'Payments[Invoice_key]))
 
which works exactly what i wanted, i have tried your solution as well but it doesnt take into consideration of finding the max date in the same set of Invoice keys.
 
thank for your time with this 🙂

View solution in original post

2 REPLIES 2
deng2431
Helper I
Helper I

Hi Magnus,

 

Thank you for your response, i just so happen to came across a solution to my issues earlier using the below query:

 

Payment date (Final) = calculate(max(Payments[Payment date]),  allexcept(Payments, 'Payments[Invoice_key]))
 
which works exactly what i wanted, i have tried your solution as well but it doesnt take into consideration of finding the max date in the same set of Invoice keys.
 
thank for your time with this 🙂
Anonymous
Not applicable

You can create the following new measure and add it to your visual.

Latest payment =
CALCULATE(
    MAX(Payments[Payment date]),
    REMOVEFILTERS(Payments[Payment date])
)
 
The filter condition will allow finding the maximum payment date but keeping the Invoice_key to be the same.
 
Br,
Magnus

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.