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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kerya
Frequent Visitor

Sum of count of filtered values by 60 days within a date

Case IDLocationDate
11239/22/21
24569/1/21
36786/24/21
41237/15/21
51239/5/21

 

LocationEnd Date
1238/25/21
1239/30/21
6786/30/21

 

I am trying to figure out how I would count the case ID's in the first table within 60 days of each respective location's contract end date. Some locations have multiple contract end date's, so I would also be trying to sum the results from both of those counts. I haven't had any luck setting up this formula yet.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kerya ,

 

You can create a measure like

Count =
SUMX (
    'Table (2)',
    CALCULATE (
        COUNT ( 'Table'[Case ID] ),
        FILTER (
            'Table',
            [Date] <= MAX ( 'Table (2)'[End Date] )
                && [Date]
                    >= MAX ( 'Table (2)'[End Date] ) - 60
        )
    )
)

 

Each row is the count corresponding to Location and End Date, and Total is the sum of all.

4.png

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @kerya ,

 

You can create a measure like

Count =
SUMX (
    'Table (2)',
    CALCULATE (
        COUNT ( 'Table'[Case ID] ),
        FILTER (
            'Table',
            [Date] <= MAX ( 'Table (2)'[End Date] )
                && [Date]
                    >= MAX ( 'Table (2)'[End Date] ) - 60
        )
    )
)

 

Each row is the count corresponding to Location and End Date, and Total is the sum of all.

4.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ashish_Mathur
Super User
Super User

Hi,

Show the expected result please.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.