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
maivarss
Employee
Employee

Average headcount calculation

Hi,

 

I currently have a large dataset that includes both headcount and financial data over a 12 month period. The heacount is reflected as a number by area and month, and I would like include a measure calculating the average headcount for the period in question (where it is possible to change the period for the average headcount calculation based on what period I'm chosing). For all financial data, the headcount column displays 0, and thus I fail to succeed using an average calculation (even after trying various methods to filter out the 0s). Help would be greatly appreciated!

 

Thanks,

 

Malin

4 REPLIES 4
Greg_Deckler
Super User
Super User

= CALCULATE(AVERAGE([Value]),[Value] > 0)

?

 

@maivarss


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks smoupre, didn't specify my question clearly 🙂 I tried your suggestion before, and this only gives me the average by the district in the regions (which is quite low as there are very many districts), which then doesn't roll up to e.g. a global headcount average for the month for ALL the districts combined. So I suspect I need to somehow include a sum in the average formula - any thoughts?

Can you give me some sample data and desired outcome?

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Do you want the average to be the total headcount divided by the number of regions, rather than the number of districts? AVERAGE() will return SUM( 'Table'[Field] ) / COUNT( 'Table'[Field] ). If you want a different denominator, just use a SUM() measure over an alternate count:

 

HeadCount =
SUM( FactHeadCound[HeadCountAmount] )

Regions =
DISTINCTCOUNT( FactHeadCount[Region] )

Average HeadCount across Regions =
DIVIDE( [HeadCount], [Regions] )

You can obviously do similar for other denominators.

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.