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
asd2525
Regular Visitor

PowerPivot CountIf date in one row is after a date in another

I am using Power Query and Power Pivot to try and create a living report that can be edited. I have one column with a unique ID, another with the date the entry was made, and another with the follow up date. I want to write a formula that essentially is a countif funtion. I want it to count the number of rows that match the ID of that row and have an entry date equal to or greater than the follow up date. I have tried numerous formulas with Calculate and Countrows but I can't figure out how to get this to come out. Any help would be appreciated. 

1 ACCEPTED SOLUTION

Hi @asd2525 

Create a new column

new column =
VAR Max_each_id =
    CALCULATE ( MAX ( 'Table'[Entry Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    IF ( Max_each_id >= [Followup Date], 1, 0 )
Capture20.JPG
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
AnkitBI
Solution Sage
Solution Sage

Share Sample data for your table or a copy of your pbix file with data

I am dealing with HIPPA data so I can't share but this is an example of what I want to be able to do with powerpivot.

The equation that I would use in a regular table would be =IF(COUNTIFS($D$2:$D$5,$D2,$A$2:$A$5,">="&$E2),"Yes","No")

I can't figure out how to get the same results with PowerPivot

DateName DOBIDFollowup DateFollowup Occurred?
8/18/2019John Doe1/1/1901John Doe3679/18/2019Yes
8/25/2019Jane Doe2/2/1902Jane Doe7649/25/2019No
9/3/2019John Smith3/3/1903John Smith115810/3/2019No
9/18/2019John Doe1/1/1901John Doe36710/18/2019No

Hi @asd2525 

Create a new column

new column =
VAR Max_each_id =
    CALCULATE ( MAX ( 'Table'[Entry Date] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
RETURN
    IF ( Max_each_id >= [Followup Date], 1, 0 )
Capture20.JPG
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.