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

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] ) )
    )
)

Regards
Zubair

Please try my custom visuals

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] ) )
    )
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

@Zubair_Muhammad Thanks! It works.

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.