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
tvaishnav
Helper IV
Helper IV

DAX formula to return value corresponding to latest date.

I have a table with 12 columns. Two of those colums are week ending date and cost . I want to return the cost corresponding to latest week ending date. Can someone help me with the formula? 

1 ACCEPTED SOLUTION

That helped. However I had to tweak it a little.

CALCULATE(FIRSTNONBLANK(Data[To Date MH/UN],1=1),FILTER(Data,Data[Week ending date]=MAX(Data[Week ending date])))

 

When I tried to use your code, I was not able to select the required field. For some reason, it was not acceting the field [To Date MH/UN]. I had to use FirstNoBlank and use 1=1 in the expression part of the function.

 

Thank you for your help!

View solution in original post

2 REPLIES 2
ryan_mayu
Super User
Super User

@tvaishnav 

 

Please try below coding to see if this can meet your requirement. Thanks.

 

Measure = CALCULATE(SELECTEDVALUE(Sheet2[cost]),FILTER(Sheet2,Sheet2[week]=MAX(Sheet2[week])))

1.PNG2.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




That helped. However I had to tweak it a little.

CALCULATE(FIRSTNONBLANK(Data[To Date MH/UN],1=1),FILTER(Data,Data[Week ending date]=MAX(Data[Week ending date])))

 

When I tried to use your code, I was not able to select the required field. For some reason, it was not acceting the field [To Date MH/UN]. I had to use FirstNoBlank and use 1=1 in the expression part of the function.

 

Thank you for your help!

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