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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
byWing
Helper I
Helper I

How to average without zero and by different category

Hi all,


I need help with this for a survey which I have conducted. 

 

I have this set of survey which I am trying to find the average hours/ people without zero:

PlacePeopleCategoryTaskSub-taskHours per month
WarehouseJohnOperationsPMPM Preperapation5
WarehouseJohnOperationsPMPM execution10
WarehouseJohnOperationsCMCM Preparation5
WarehouseJohnOperationsCMCM execution10
WarehouseJohnProjectProject supportProject Plan0
WarehouseJohnProjectProject supportSite Study0
WarehouseJohnProjectProject supportProject execution0
WarehouseMayOperationsPMPM Preperapation3
WarehouseMayOperationsPMPM execution2
WarehouseMayOperationsCMCM Preparation3
WarehouseMayOperationsCMCM execution5
WarehouseMayProjectProject supportProject Plan10
WarehouseMayProjectProject supportSite Study5
WarehouseMayProjectProject supportProject execution5
StoreTimOperationsPMPM Preperapation5
StoreTimOperationsPMPM execution6
StoreTimOperationsCMCM Preparation10
StoreTimOperationsCMCM execution5
StoreTimProjectProject supportProject Plan0
StoreTimProjectProject supportSite Study0
StoreTimProjectProject supportProject execution0
StoreJuneOperationsPMPM Preperapation5
StoreJuneOperationsPMPM execution9
StoreJuneOperationsCMCM Preparation4
StoreJuneOperationsCMCM execution6
StoreJuneProjectProject supportProject Plan10
StoreJuneProjectProject supportSite Study5
StoreJuneProjectProject supportProject execution9

 

 

byWing_0-1683541744863.png


I tried using this:

Avg hours without zeros = CALCULATE(AVERAGE('Table'[Hours Per Month]),FILTER('Table','Table'[Hours Per Month]<>0))
BUT it only works if I am breaking down my visual using sub-task, but not with the category.


What I hope to get:

1. Average hours per person in each place by category, with the tasks as legend.

2. Average hours per person in each place by task, with the sub-tasks as legend.

and 3. Average must exclude the people who input 0 for that category, task or sub-task (to remove the outliners)

 

I am getting myself all confused after reading all the posts. Any help will be much appreciated.

 

Thank you so much~

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @byWing 

 

You can try the following methods.

Measure = 
Var _table=FILTER('Table',[Hours per month]<>0)
Return
AVERAGEX(_table,[Hours per month])

vzhangti_0-1683685063943.png

vzhangti_2-1683685097696.png

Is this the result you expect? If not, please provide more sample output.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @byWing 

 

You can try the following methods.

Measure = 
Var _table=FILTER('Table',[Hours per month]<>0)
Return
AVERAGEX(_table,[Hours per month])

vzhangti_0-1683685063943.png

vzhangti_2-1683685097696.png

Is this the result you expect? If not, please provide more sample output.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Kudoed Authors