Forum Discussion

Analyst_PowerBI's avatar
Analyst_PowerBI
Frequent Visitor
8 years ago
Solved

Average excluding 0

Hello,   I´m trying to get the average number of a week, using this DAX-Formula: CALCULATE(AVERAGEX(table;[Share]);ALLEXCEPT(Datetable;Datetable[Last 4 weeks]))   The problem is that some values...
  • v-sihou-msft's avatar
    8 years ago

    Analyst_PowerBI

     

    In DAX, AVERAGE()/AVERAGEX() function will ingore entries with empty values. In your scenario, to ingore 0 values as well, you just need to put ALLEXCEPT() into FILTER() function. See my sample below:

     

    Avg Per Week =
    CALCULATE (
        AVERAGE ( Table1[Sales] ),
        FILTER ( ALLEXCEPT ( Table1, Table1[Week] ), Table1[Sales] <> 0 )
    )
    

     

    Regards,