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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JULY1
Helper I
Helper I

Average count in each month

Hi,

 

I tried to calculate the average of number of employee in each month.

Here's the example of my data, there is no duplicate of employee id in each month.

JULY1_0-1683810294062.png

 

The result i would like to see using Matrix visualization is in the red box 

JULY1_2-1683810535503.png

from the second month and so on, the formula in my excel looks like this =AVERAGE($E$2:F2

F2 will change based on month, (G2 in march / H2 in april so on and so forth)

 

I've tried the averagex 

 

AVERAGEX (

VALUES ('HR Report 2023'[Month]),
CALCULATE ( COUNT ( 'HR Report 2023'[Employee ID]))
 

, however it only retuned the average in total (6), but I would like to see the average in each month.

And the result from the average will be the denominator to calculate the attrition.

 

Please help me.

*Sending appreciation in advance* and thank you a lot.

1 ACCEPTED SOLUTION

hi @JULY1 

I overlooked the filter context, try like:

 

measure = 
DIVIDE(
   COUNTROWS(
        FILTER(
           ALL(data), 
           data[Month]<=MAX(data[Month])
        )
    ),
   MAX(data[Month]) 
)

 

tried with your original dataset, it worked like:

FreemanZ_1-1683864442649.png

 

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

hi @JULY1 

try to plot a visual with month column and a measure like:

measure =
DIVIDE(
   COUNTROWS(
        FILTER(
           data, 
           data[Month]<=MAX(data[Month])
        )
    ),
   MAX(data[Month]) 
)

Thank you @FreemanZ 

 

I tried it with my real data, and this result is still not correct.

(The data type for month column is text right now)

 

The result from Power BI - 

JULY1_0-1683858846610.png

I think it is because the number in each month is divided by the number of month instead of the sum number.

JULY1_1-1683859032069.png

 

 

hi @JULY1 

could you update your sample dataset to better reflect your case?

Sure, my data looks like this, I have around 15k+ employees in each month.

JULY1_1-1683860825261.png

 

And this the expected result is in red box.

JULY1_2-1683861343677.png

 

 

 

hi @JULY1 

I overlooked the filter context, try like:

 

measure = 
DIVIDE(
   COUNTROWS(
        FILTER(
           ALL(data), 
           data[Month]<=MAX(data[Month])
        )
    ),
   MAX(data[Month]) 
)

 

tried with your original dataset, it worked like:

FreemanZ_1-1683864442649.png

 

Yes, it worked!

Thank you a lot!

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.