Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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 |
Solved! Go to Solution.
@juliaellershaw , Try like
averageX(filter(Table, Table[Question]="Q1"), Table[Answer])
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.
@juliaellershaw , Try like
averageX(filter(Table, Table[Question]="Q1"), Table[Answer])
That worked, thank you!
Hi,
To your visual, drag Question to the visual and select Q1. Write this measure
=average(data[answer])
Hope this helps.
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
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
User | Count |
---|---|
124 | |
108 | |
99 | |
62 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |