Forum Discussion

steambucky's avatar
steambucky
Helper III
6 years ago
Solved

Getting averages from SPECIFIC rows

Units of a department are getting evaluated on 4 things.  Anywhere there is a 0 means that unit is not yet evaluated. I need to create averages from units that HAVE been evaluated. 

This is the data: 

DepartmentUnitStaff Efficency Staff trainingManager Efficency Manager Training 
Natural resources, Mines and EnergyMines3224
Natural resources, Mines and EnergyEnvironmental Science0000
Natural resources, Mines and EnergyFisheries0000
Natural resources, Mines and EnergyEnergy2342
Natural resources, Mines and EnergyClimate science1215

 

This is the desired output is something like this: 

 

 Staff Efficency Staff trainingManager Efficency Manager Training 
Natural resources, Mines and Energy - Average scores22.32.33.6

 

Doing the averages with but including the two units that have ZEROs in the data will create averages like this: 

 

 Staff Efficency Staff trainingManager Efficency Manager Training 
Natural resources, Mines and Energy - Average scores1.21.41.42.2

 

Whats the easiest way can get the averages of the units that HAVE been assessed? 

 

Note: If change my base data and subsitute "NOT ASSESSED" for the 0s, Excel is happy enough to only calculate averages on the numbers in the columns and gives me the right result. Power BI doesnt like the like a mix of data types ( numbers and text ) and and I get errors.  

  • You can use AVERAGEX and replace the zeros with blanks in the measure without changing your underlying data. Blanks are not evaluated with the AVERAGEX function.

     

     

     

    Manager Training Avg = 
        AVERAGEX('DataTable',
            IF(
                'DataTable'[Manager Training] > 0,
                'DataTable'[Manager Training],
                BLANK()
                )
        )

     

     

3 Replies

  • edhans's avatar
    edhans
    Community Champion

    You can use AVERAGEX and replace the zeros with blanks in the measure without changing your underlying data. Blanks are not evaluated with the AVERAGEX function.

     

     

     

    Manager Training Avg = 
        AVERAGEX('DataTable',
            IF(
                'DataTable'[Manager Training] > 0,
                'DataTable'[Manager Training],
                BLANK()
                )
        )

     

     

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    Hi steambucky ,
    Please try this 

    Mgr EfficiencyAverage no zeros = CALCULATE(AVERAGE(NR[Manager Efficency ]),NR[Manager Efficency ]<>0)



    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel