Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
Super User

@juliaellershaw , Try like

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

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
Super User

@juliaellershaw , Try like

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

That worked, thank you!

Ashish_Mathur
Super User
Super User

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


Anonymous
Not applicable

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.