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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Calculate event count per month-year and operator

Dear all,

 

  I'm trying to create a calculated column ('Event_Count') that would sum up all "1" of column "Event" based on the month-year and on the operator. For example, below is January 2017 data. The sum of the "1" in Event is 2 for January 2017 and Operator A. The column 'Event_Month' should just count the total for the matching month-year and opeator at every cell. Does anyone know how to do it?

 

DateEventOperatorEvent_Count
1-Jan-170  
2-Jan-170  
3-Jan-170  
4-Jan-170  
5-Jan-171A2
6-Jan-170  
7-Jan-170  
8-Jan-170  
9-Jan-171B4
10-Jan-170  
11-Jan-170  
12-Jan-171A2
13-Jan-170  
14-Jan-170  
15-Jan-171B4
16-Jan-170  
17-Jan-170  
18-Jan-170  
19-Jan-171B4
20-Jan-171C2
21-Jan-170  
22-Jan-170  
23-Jan-170  
24-Jan-171C2
25-Jan-170  
26-Jan-170  
27-Jan-170  
28-Jan-170  
29-Jan-170  
30-Jan-171B4
31-Jan-170  

 

Thank you.

1 ACCEPTED SOLUTION

Hi @Anonymous

 

Try this Calculated Column

 

EventCount =
COUNTROWS (
    FILTER (
        TableName,
        TableName[Operator] = EARLIER ( TableName[Operator] )
            && TableName[Event] = 1
            && MONTH ( TableName[Date] ) = MONTH ( EARLIER ( TableName[Date] ) )
            && YEAR ( TableName[Date] ) = YEAR ( EARLIER ( TableName[Date] ) )
    )
)

View solution in original post

4 REPLIES 4
BeemsC
Resolver III
Resolver III

Does it need to be in 1 column? And are you allowed to use measures?

Anonymous
Not applicable

@BeemsC unfortunately it has to be a calculated column...

Hi @Anonymous

 

Try this Calculated Column

 

EventCount =
COUNTROWS (
    FILTER (
        TableName,
        TableName[Operator] = EARLIER ( TableName[Operator] )
            && TableName[Event] = 1
            && MONTH ( TableName[Date] ) = MONTH ( EARLIER ( TableName[Date] ) )
            && YEAR ( TableName[Date] ) = YEAR ( EARLIER ( TableName[Date] ) )
    )
)
Anonymous
Not applicable

@Zubair_Muhammad Thanks! It works.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors