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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ehmacc
Frequent Visitor

Returning the Max Date for a set, with an added filter

I am trying to create a new column on a table that is a Max calculation with a filter- in this instance, I need to return the Max Date but only if the Rate Change was grater than 0 (example table below).

 

Right now I am using an equation that returns the Max Date for Each ID, but I need to filter that return to only be if that date was associated with an increase 

 

Current equation-

Most Recent Rate Change = CALCULATE(max (EmploymentHistory[Date]), ALLEXCEPT(EmploymentHistory, EmploymentHistory[Id]))
 
IDDateRate Change

Current Date returned

Most Recent Rate Change (DESIRED RESULT)
17/3/190%7/3/196/8/19
16/8/194%7/3/196/8/19
15/1/183%7/3/196/8/19
28/8/192%8/8/198/8/19
22/17/187%8/8/198/8/19

 

I have tried to build the filter into the equation in multiple ways, and keep failing, I need it as part of the equation rather than a filter on a visual or table becuase it will be built used 

1 ACCEPTED SOLUTION
lc_finance
Solution Sage
Solution Sage

Hi @ehmacc ,

 

 

You can use the following formula:

 

Most recent rate change (calculated) = 

CALCULATE(LASTDATE('EmploymentHistory'[Date]), ALLEXCEPT('EmploymentHistory','EmploymentHistory'[ID]), 'EmploymentHistory'[Rate Change]>0)

Basically I added one more condition to the CALCULATE filter: rate should be higher than 0.

 

Here is a screenshot of what it looks like.

Most recent rate change.png

 

Finally, here is a Power BI file with the new formula.

 

Does this help you? Let me know if you have further questions,

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

View solution in original post

3 REPLIES 3
lc_finance
Solution Sage
Solution Sage

Hi @ehmacc ,

 

 

You can use the following formula:

 

Most recent rate change (calculated) = 

CALCULATE(LASTDATE('EmploymentHistory'[Date]), ALLEXCEPT('EmploymentHistory','EmploymentHistory'[ID]), 'EmploymentHistory'[Rate Change]>0)

Basically I added one more condition to the CALCULATE filter: rate should be higher than 0.

 

Here is a screenshot of what it looks like.

Most recent rate change.png

 

Finally, here is a Power BI file with the new formula.

 

Does this help you? Let me know if you have further questions,

 

LC

Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com

Nathaniel_C
Community Champion
Community Champion

Hi @ehmacc ,
You were almost there. Just needed a condition. Let me know if this works for you...it is a measure

 

Most Recent Rate Change = CALCULATE(MAX(EmploymentHistory[Date]),Filter(ALLEXCEPT(EmploymentHistory,EmploymentHistory[ID]),EmploymentHistory[Rate Change]<>0))

 

rate chg.PNG

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





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

Proud to be a Super User!




Thank you so much!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors