cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
juliaellershaw
Frequent Visitor

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

1 ACCEPTED SOLUTION
amitchandak
Super User IV
Super User IV

@juliaellershaw , Try like

averageX(filter(Table, Table[Question]="Q1"), Table[Answer])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

7 REPLIES 7
v-yangliu-msft
Community Support
Community Support

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.

v-yangliu-msft_0-1606091919384.jpeg

.

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.

v-yangliu-msft_1-1606091919387.jpeg

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.

amitchandak
Super User IV
Super User IV

@juliaellershaw , Try like

averageX(filter(Table, Table[Question]="Q1"), Table[Answer])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

That worked, thank you!

Ashish_Mathur
Super User III
Super User III

Hi,

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

=average(data[answer])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
juliaellershaw
Frequent Visitor

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





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


rajveer1117
Helper III
Helper III

Measure= var x=SUMMARIZE('Table','Table'[Q1],"av",AVERAGE('Table'[7]))return AVERAGEX(x,[av])

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are You Ready?

Test your skills now with the Cloud Skills Challenge.

Top Solution Authors