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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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