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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Need to calculate occurrence of an object between two dates from an excel

Hello Guys,

 

I want to calculate the count of Ip address repeated between the createion date and  90 days ago this creation date 
plz help me how to calculate 

Ip                   Creation Date   creation date 90 days ago

10.10.122.10    1/1/2021         3/10/2020

12.12.199.10     4/1/2021        6/10/2021
10.10.122.10    1/1/2021          3/10/2021
13.12.12.10      1/1/2021          3/10/2020

 

result should be 
count
1
1
2
1

Thanks

Pra137

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

Try this code to create a calculated column.

Count =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        'Sample',
        AND (
            'Sample'[Ip] = EARLIER ( 'Sample'[Ip] ),
            'Sample'[creation date 90 days ago]
                <= EARLIER ( 'Sample'[creation date 90 days ago] )
        )
    )
)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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
amitchandak
Super User
Super User

@Anonymous , a new column

 


New colume =
var _dt1 = [Creation Date] - 90
var _dt2 = [Creation Date] + 90
return
countx(filter(Table, [Creation Date] >=_dt1 && [Creation Date] <=_dt2), [ip])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

It show me the total count of Ip address in column like 1999 for all rows i want to see 1,2,3 count of ip

Anonymous
Not applicable

Hi @Anonymous 

Try this code to create a calculated column.

Count =
CALCULATE (
    COUNTROWS ( 'Sample' ),
    FILTER (
        'Sample',
        AND (
            'Sample'[Ip] = EARLIER ( 'Sample'[Ip] ),
            'Sample'[creation date 90 days ago]
                <= EARLIER ( 'Sample'[creation date 90 days ago] )
        )
    )
)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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