cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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 🙂
magsod
Solution Supplier
Solution Supplier

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors