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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Revanth_Reddy
New Member

Help Needed : Incremental Counting of calls within 7 Days in power BI with Excel Reference

Hi everyone,

I'm trying to replicate an Excel formula in Power BI that counts the number of calls made within a 7-day window for each Contact Number. I have an Excel file with the relevant data and the formula that works correctly, but I'm struggling to get the same results in Power BI.

Sample Data:

Contact NoCall Date
712015/13/2024
20120532985/1/2024
20120532985/2/2024
20120532985/10/2024
20120881025/30/2024
20120881025/30/2024
20120881025/30/2024
20120881026/8/2024
20120881026/10/2024
20120886235/15/2024
20122062825/16/2024
20123813335/7/2024
20123813334/30/2024
20123814305/8/2024
20124049245/3/2024
20125061035/6/2024
20125061035/6/2024
20125061035/8/2024

 

Desired Output:

The expected output I want in Power BI is:

Contact NoCall DateRepeat Count with 7 days
712015/13/20241
20120532985/1/20241
20120532985/2/20242
20120532985/10/20241
20120881025/30/20241
20120881025/30/20242
20120881025/30/20243
20120881026/8/20241
20120881026/10/20242
20120886235/15/20241
20122062825/16/20241
20123813335/7/20241
20123813334/30/20241
20123814305/8/20241
20124049245/3/20241
20125061035/6/20241
20125061035/6/20242
20125061035/8/20243

 

Excel Formula:

In Excel, I am using the following formula:


=COUNTIFS($A$1:A2,$A2,$B$1:B2,"<="&B2,$B$1:B2,">="&INT(B2)-7)

Current DAX Formula (For Calculated Column)

Here is the DAX formula I’m currently trying to implement:

Repeat Count With 7 days  =

 

VAR Current No = 'Table'[Contact No]

VAR CurrentCallDate = 'Table'[Call Date]

 

VAR StartDate = CurrentCallDate - 7

RETURN

    COUNTROWS(

 

        FILTER(

            'Table',

            'Table'[ Contact No  ] = CurrentANI &&

            'Table'[ Call Date  ] <= CurrentCallDate &&

            'Table'[ Call Date  ] >= StartDate

        )

    )

 

Unfortunately, the DAX formula is not returning the expected incremental counts.

Could anyone help me modify my DAX formula to achieve the desired output?

I'm attaching the link for the sample data file.

Link :- https://docs.google.com/spreadsheets/d/1UrX49kV6zfVzON3KEtdutjcRSYjbrupZ/edit?usp=sharing&ouid=10015...



Thanks in advance!

@amitchandak @Greg_Deckler @lbendlin @Kedar_Pande @rajendraongole1 @Ritaf1983 @parry2k @audreygerred @SamWiseOwl @dharmendars007 @Omid_Motamedise @Jihwan_Kim @danextian @Ashish_Mathur @ibarrau



 

1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1729566854076.png

 


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.


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

Hi Ashish,

Thank you for your solution. However, the PBIX result you shared shows the incremental count for all calls based on the contact number. I’m trying to track call repeats over a 7-day window. Here’s what I need:

  1. For calls that occur within the 7-day window, there should be an incremental count.
  2. If a repeat call occurs after the 7-day period, the count should restart from 1 and then increment from there.

If you check my sample data output file, you’ll see how the 7-day period is applied.

Could you please adjust the PBIX to reflect this logic?

Thank you!

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1729566854076.png

 


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

@Revanth_Reddy assuming you are adding this as a calculated column, try this:

 

Repeat Count With 7 days = 
VAR CurrentNo = 'Table'[Contact No]
VAR CurrentCallDate = 'Table'[Call Date]
VAR StartDate = CurrentCallDate - 6
VAR RowsCount = 
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Call Date] ),
        FILTER(
            ALL ( 'Table' ),
            'Table'[Contact No] = CurrentNo &&
            'Table'[Call Date] <= CurrentCallDate &&
            'Table'[Call Date] >= StartDate
        )
    )
RETURN
RowsCount


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.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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