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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
byWing
Frequent Visitor

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.