Search code examples
powerbiaverage

Include months with no entries in POWER BI's AVERAGEX


I have a data set with purchase registers that are divided in different categories. Those registers have a date, and I want to have a measure related to the monthly average.

By using:

Average = AVERAGEX(VALUES(Table[Month]),[Var_total])

I'm able to do so. The problem is: for some categories, there are months without entries, and those are excluded from the average, instead of being counted as zeros. How can I include them?

For example, if i spend 500 currencies in a month in the "car" category, and 0 in the next, I want the average to be 250, and not 500.


Solution

  • Maybe this would work?

    Average = 
      AVERAGEX(
        VALUES(Table[Month]), 
        COALESCE( [Var_total], 0 )
      )