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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
ConnieMaldonado
Responsive Resident
Responsive Resident

Calculate Max Date by Employee Number

Hello - I need to create a filter to determine the max date by employee ID for a table which has the following:

 

RVPRDOLocation  DATETech NameEmployee Number
RVP 1RDO 1Norfolk1/16/2021Doe, John149531
RVP 1RDO 1Norfolk1/18/2021Doe, John149531
RVP 1RDO 1Norfolk12/29/2020Doe, John149531
RVP 1RDO 1Norfolk12/30/2020Doe, John149531
RVP 1RDO 1Norfolk12/31/2020Doe, John149531
RVP 1RDO 2VA Beach1/5/2021Morgan, Terry123456
RVP 1RDO 2VA Beach1/6/2021Morgan, Terry123456
RVP 1RDO 2VA Beach1/7/2021Morgan, Terry123456
RVP 1RDO 2VA Beach1/8/2021Morgan, Terry123456

 

I want to return the max date by employee number.  I tried the following:

Max Date = MAX(MAX('Table','Table'[DATE])) and MAXX(MAX('Table','Table'[DATE]))

 

but that returned the date.

Any help would be appreciated.  Thanks!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@ConnieMaldonado use this expression:

 

Max Date = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Employee Number] ) )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
ConnieMaldonado
Responsive Resident
Responsive Resident

I got this to work.  I was able to create a column for the hours and used your code above!  Thanks!  You're the best.

 

Max Date =
CALCULATE (
MAX ( 'Table'[Date] ),
ALLEXCEPT ( 'Table', 'Table'[Employee Number] ) ,
'Table'[Total Hours] > 0
)

parry2k
Super User
Super User

@ConnieMaldonado if Total Hours is a column, make this change

 

Max Date = 
CALCULATE ( 
MAX ( 'Table'[Date] ), 
ALLEXCEPT ( 'Table', 'Table'[Employee Number] ) 
'Table'[Total Hours] > 0
)

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Unfortunately, Total Hours is a measure.  I tried the statement above, but of course Total Hours is not allowed in the expression.  I've tried several different things to no avail. 

parry2k
Super User
Super User

@ConnieMaldonado use this expression:

 

Max Date = CALCULATE ( MAX ( 'Table'[Date] ), ALLEXCEPT ( 'Table', 'Table'[Employee Number] ) )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you - one more question.  I have a measure to calculate Total Hours for each employee and would like to include a filter so that I'm calculating the max date for all the records for the employee for which Total Hours > 0.  I have a filter on the visual, so I'm not sure why that doesn't work.  Can I add a filter to the ALLEXCEPT statement?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors