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
AMZA
New Member

Find max date within groups and count unique records if date is overdue

Hello everyone,

 

I am looking to calculate number of unique people (ID) who's review date is overdue. And I am looking for dynamic formula which calculates on the fly and does not pick column D or E in calculation (as I have date based filters)

 

The calculation goes as follows:

- Get latest joining or review date for each person (Max of column B or C) = Answer column D

- Calculate next review date i.e. column D plus 1 month = Answer column E

- Calculate number of people who's date is overdue i.e. column F = Answer 3

 

As mentioned please suggest dynamic formula as rows can vary based on filter section. I spent couple of hours around this but couldn't achieve desired result. Thanks for your help

 

For reporting today's date is: 10-Feb-23

ABCDEF
IDJoiningdateReviewdateLatestJoining&ReviewDateNextReviewDate (+1 month)Overdue
111-Jan-23 11-Jan-2311-Feb-23 
201-Jan-2302-Jan-2307-Jan-2307-Feb-23Yes
201-Jan-2304-Jan-2307-Jan-2307-Feb-23Yes
201-Jan-2307-Jan-2307-Jan-2307-Feb-23Yes
315-Dec-2218-Dec-2225-Dec-2225-Jan-23Yes
315-Dec-2225-Dec-2225-Dec-2225-Jan-23Yes
401-Dec-2215-Dec-2220-Dec-2220-Jan-23Yes
401-Dec-2220-Dec-2220-Dec-2220-Jan-23Yes
501-Dec-2212-Jan-2312-Jan-2312-Feb-23 
      
    Answer3 people
1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Here's one way to do it in a measure expression that only needs your ID, JoiningDate and ReviewDate columns. I added count of ID column just to show the rows that don't get counted. See correct value of 3 in total (not sure what fields you plan to use in your visual). Note that I used a hardcoded date as requested, but you could use a dynamic one easily too.

 

ppm1_1-1676035476876.png

 

People Overdue =
VAR ac =
    ADDCOLUMNS (
        T1,
        "cNextReview", EDATE ( MAX ( T1[Joiningdate], T1[Reviewdate] ), 1 )
    )
VAR overdue =
    FILTER ( ac, [cNextReview] < DATE ( 2023, 2, 10 ) )
RETURN
    COUNTROWS ( SUMMARIZE ( overdue, T1[ID] ) )

 

Pat

 

Microsoft Employee

View solution in original post

2 REPLIES 2
AMZA
New Member

Hi Pat,

 

This seems to be in right direction. I was looking for logic flow and your answer makes sense. I will make date dynamic and then it should be good. 

 

Thanks

ppm1
Solution Sage
Solution Sage

Here's one way to do it in a measure expression that only needs your ID, JoiningDate and ReviewDate columns. I added count of ID column just to show the rows that don't get counted. See correct value of 3 in total (not sure what fields you plan to use in your visual). Note that I used a hardcoded date as requested, but you could use a dynamic one easily too.

 

ppm1_1-1676035476876.png

 

People Overdue =
VAR ac =
    ADDCOLUMNS (
        T1,
        "cNextReview", EDATE ( MAX ( T1[Joiningdate], T1[Reviewdate] ), 1 )
    )
VAR overdue =
    FILTER ( ac, [cNextReview] < DATE ( 2023, 2, 10 ) )
RETURN
    COUNTROWS ( SUMMARIZE ( overdue, T1[ID] ) )

 

Pat

 

Microsoft Employee

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.