Forum Discussion

osaamashehzad's avatar
osaamashehzad
Frequent Visitor
2 years ago
Solved

How to calculate conditional average by aggregating rows mapped to each participant?

I am doing a survey analysis in which each participant is identified by a unique identifier called "ID". The table contains the following cols:  Question: describes the question asked Category: de...
  • Aibloy's avatar
    2 years ago

    Hi  , 
    In PowerBI you have a function that is call CALCULATE.With this function you can modify the context in which a expression is evaluated,

    In your scenario, you want to evaluate the expression "Average":

     

     

    Average_Wellbeing = AVERAGE('Table'[Score]) 

     

     

     

    But, you want to evaluate this expression in a certain context, so, with CALCULATE:

     

     

     CALCULATE(AVERAGE('Table'[Score]),'Table'[Category]="Wellbeing") 

     

     

    Replacing 'Table' by your Table Name.

    Hope it helps!

     

     

     

     

     

    osaamashehzad