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
Anonymous
Not applicable

Need Help counting Occurrences for a given date (not cumulative)

Hello

I am looking count the number of  times "CustomerX" appears in a single column on a given date. For Example, Bob appears twice on 11/13 and once on 11/14. 

 

I have tried using COUNTX and SUMX but it counted all occurences instead of just for a single date.  Once the occurence for the date is found I would like to create a new column or measure that shows if the occurence in one day is greater than 2 it populates column as "Frequent"

 

Date - Employee Name - Customer Name

11/13/2020Employee 1 Bob
11/13/2020Employee 2Jen
11/13/2020Employee 3Bob
11/13/2020Employee 4Max
11/14/2020Employee 3Bob

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Add the following code as new column:

 

Occurrence = 
IF(
    COUNTROWS(
        FILTER(
            Table01,
            Table01[Customer Name] = EARLIER(Table01[Customer Name]) &&
            Table01[Date] = EARLIER(Table01[Date])
        )
    ) > 2,
    "Frequent"
)

 

 

If you need a measure, then add a table visual, keep Date and Customer name then add the following measure

Occurrence Measure = IF( COUNTROWS(Table01) > 2 , "Frequent")

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@Anonymous 

Add the following code as new column:

 

Occurrence = 
IF(
    COUNTROWS(
        FILTER(
            Table01,
            Table01[Customer Name] = EARLIER(Table01[Customer Name]) &&
            Table01[Date] = EARLIER(Table01[Date])
        )
    ) > 2,
    "Frequent"
)

 

 

If you need a measure, then add a table visual, keep Date and Customer name then add the following measure

Occurrence Measure = IF( COUNTROWS(Table01) > 2 , "Frequent")

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thank you very much! The IF function worked for me. 

AlB
Community Champion
Community Champion

Hi @Anonymous 

1. Place  Date in the rows of a matrix visual and Customer name in the columns

2. Create this measure and place it in values of the visual:

Measure =
IF ( COUNT ( TAble1[Customer Name] ) > 2, "Frequent" )

 

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

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.