Forum Discussion

solvisig's avatar
solvisig
Advocate III
7 years ago
Solved

Average aggregates discard 0 values

Hi, 

I´m having issue with the aggregated value of average.

the average value is calculated with all the underlying rows taken into account. I want it to discard 0 values.

 

underlying table:

source table

 

my matrix:

I want this to show (2+6+5,5)/3 = 4,5   not 4,2 as this is currently calculating (0+3+4+6+8)/5 = 4,2

 

I want also this to discard the 0 value when I filter these valuse and display total average of 3:

 

any clever DAX suggestions? :)

 

Note: I´m not using any measures in this example and I select this option to aggregate:

  • Omega's avatar
    Omega
    7 years ago

    solvisig 

     

    Try creating the below measure: 

     

    Average = AVERAGEX(FILTER(Table1,Table1[Value] <>0),Table1[Value])

     

5 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi solvisig

    How about adding a slicer on Value to eliminate the zeros? 

    • solvisig's avatar
      solvisig
      Advocate III

      That does not work for my scenario as I might have another value in the table that does not have 0 and I want to display.
      Example:

      • Omega's avatar
        Omega
        Impactful Individual

        solvisig 

         

        Try creating the below measure: 

         

        Average = AVERAGEX(FILTER(Table1,Table1[Value] <>0),Table1[Value])