Forum Discussion

byWing's avatar
byWing
Helper I
3 years ago
Solved

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

 

 


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~

  • Hi, byWing 

     

    You can try the following methods.

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

    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

1 Reply

  • v-zhangti's avatar
    v-zhangti
    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])

    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