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

View all the Fabric Data Days sessions on demand. View schedule

Reply
jcastr02
Post Prodigy
Post Prodigy

DAX calculation from a table

I am trying to do below calculation     

 

Sum of Terms / Average Headcount as example using 1/1/20+2/1/20 ...

 

230+231 = 461 (Sum of Terms)

3651+3696 =7,347 / 2 =3,673.5 (average headcount)

461/3,673.5 = 12.55%    but measure shows 12.71% need help with DAX

 

see screen shots belowAttrition new new.png

1 ACCEPTED SOLUTION

@jcastr02 , please find the attached file after signature

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

11 REPLIES 11
Greg_Deckler
Community Champion
Community Champion

@jcastr02 Sorry, having trouble following, can you post sample data as text and expected output?


Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler I've provided an example above in screen shot using 1/1/20 +2/1/20

I should have % at 12.55% - Can you take a look at my measure below to see what is incorrect.... trying to do sum of terms / average headcount

Attrition new new.png

@jcastr02 - Sorry, but I am not hand typing all of that in order to mock up a model. Maybe someone else will.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@jcastr02 ,

Hope you are doing like

divide(sum(Table[Terms]), Average(Table[Headcount]))

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Hello, please see screen shot of query above, the count type is in a different column ... I also provided an example in the screen shot in lower left side...

@amitchandak

In my visual, I'm showing it by month..... Query data provided below - + also screen shot of my visual table...

Attrition should be 12.55% (Sum of Terms / Average Headcount) and looking at this data by month

Query Data
Business UnitFile_date1CountCount Type
Miami1/1/2020581Headcount
Chandler1/1/2020704Headcount
Orlando Care1/1/2020699Headcount
Orlando Support1/1/20201081Headcount
Muscle Shoals1/1/2020586Headcount
Orlando Support1/1/202017Terms
Miami1/1/202036Terms
Chandler1/1/202064Terms
Muscle Shoals1/1/202019Terms
Orlando Care1/1/202095Terms
Muscle Shoals2/1/2020554Headcount
Orlando Support2/1/20201100Headcount
Chandler2/1/2020729Headcount
Miami2/1/2020523Headcount
Orlando Care2/1/2020790Headcount
Chandler2/1/202031Terms
Orlando Support2/1/202025Terms
Orlando Care2/1/2020109Terms
Miami2/1/202042Terms
Muscle Shoals2/1/202023Terms

visual

visausl.png

@jcastr02 , please find attached file after signature

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@jcastr02 , please find the attached file after signature

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I can't tell you how much I appreciate this!!! Thank you

@jcastr02 , Try

 

Divide(sumx(filter(Table, Table[CountType]= "Headcount"),Table[Count]),AverageX(filter(Table, Table[CountType]= "Terms"),Table[Count]))

or

Divide(sumx(filter(Table, Table[CountType]= "Headcount"),Table[Count]),Divide(SumX(filter(Table, Table[CountType]= "Terms"),Table[Count]),Countx(filter(Table, Table[CountType]= "Terms"),Table[Count])))

 

if this does not work out. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@Greg_Deckler Hello Greg, sorry about that, does this help?

Business Unit File_date1 Count Count Type

Miami1/1/2020581Headcount
Chandler1/1/2020704Headcount
Orlando Care1/1/2020699Headcount
Orlando Support1/1/20201081Headcount
Muscle Shoals1/1/2020586Headcount
Muscle Shoals2/1/2020554Headcount
Orlando Support2/1/20201100Headcount
Chandler2/1/2020729Headcount
Miami2/1/2020523Headcount
Orlando Care2/1/2020790Headcount
Orlando Support1/1/202017Terms
Miami1/1/202036Terms
Chandler2/1/202031Terms
Orlando Support2/1/202025Terms
Chandler1/1/202064Terms
Orlando Care2/1/2020109Terms
Miami2/1/202042Terms
Muscle Shoals1/1/202019Terms
Orlando Care1/1/202095Terms
Muscle Shoals2/1/202023Terms

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors