Forum Discussion

juliaellershaw's avatar
juliaellershaw
Frequent Visitor
5 years ago
Solved

Average measure

Hi, I have some survey data and am trying to work out the formula for a measure that will give me the average of the answers for only one of the questions. For example, with this example data, how would I get the average just for the answers for Q1?

Question

Answer

Q1

7

Q1

5

Q1

6

Q2

6

Q2

4

Q2

2

Q2

7

Q3

5

Q3

3

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    Measure= var x=SUMMARIZE('Table','Table'[Q1],"av",AVERAGE('Table'[7]))return AVERAGEX(x,[av])
  • Thanks for the formula. I'm getting an error with this seciton "SUMMARIZE('Table','Table'[Q1]," that says it can't find the column for Q1

    • mahoneypat's avatar
      mahoneypat
      Microsoft Employee

      You need to replace "Table" with the actual name of your table. 

       

      Alternatively, you could just make a table visual on your report page, and add the Question column and the Answer column.  On the Answer column in the field pane, change the aggregation to average.

       

      Regards,

      Pat

  • Hi,

    To your visual, drag Question to the visual and select Q1.  Write this measure

    =average(data[answer])

    Hope this helps.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  juliaellershaw ,

    There are two ways to do this:

    一.

    1. Create calculated table.

    Q1_avg_column =
    CALCULATE(AVERAGE('Table'[amount]),FILTER('Table','Table'[quarter]="Q1"))

    2. Result.

    .

    1. Create measure.

    Q1_avg_measure =
    CALCULATE(AVERAGE('Table'[amount]),FILTER('Table','Table'[quarter]=MAX('Table'[quarter])))

    2. Place the quarter field in slice, and set Q1_ avg_ Put measure in card

    3. Result.

    You can downloaded PBIX file from here.

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.