Forum Discussion

oll's avatar
oll
New Member
9 years ago
Solved

AVERAGE IF function DAX

Hey,   Wonder if there is a way to make a calculated measure to calculate the average of all numbers that belongs to a certain category.   For example, if there is a DAX expression to calculate t...
  • Vvelarde's avatar
    9 years ago

    oll

     

    Hi, a way to obtain this is:

     

    AverageNumberofComputers=Calculate(average(Table[ColumnNumbers]),Filter(Table, Table[ColumnName]="Computers"))

     

    Let me know if you need more help

  • Sean's avatar
    Sean
    9 years ago

    If you want to calculate the average only for 1 category at a time go with the above method

    However if you have MANY more categories you can create a simple average measure and use it in a Matrix

    Place category in the Rows and that Measure will be sliced per Category

    Average Measure = AVERAGE ( 'Table'[Value] )

    Even easier you can just drag the value column again to the Values area - right click and change the aggregation - as shown below...

    Hope this helps! :smileyhappy: