Average IF in DAX

Itayc

New Member
Joined
May 15, 2018
Messages
6
Hey,

What I need is to make an average of all the numbers under heading A (there are 3 in the example), but the calculation will be by line rather than column.
For example: At Sarah's row, the new column will sum up the numbers 5+10+10 because they are under a header that contain the letter "A", and then will be divide by 3.
Final result will be 8.33 for Sarah's team.
[FONT=&quot]
[/FONT]
5611759.PNG


Thanks for helping!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
My browser won't show the image so I can't tell exactly what's happening, but you might want to consider doing this in Power Query. Do the heading names change? If there are n columns with "A" but a row value of a particular column has no value would your average be based on n or n-1?
 
Upvote 0
That doesn't quite answer which way you want the calculation to go. However, as a possibility...

In PowerQuery unpivot the columns that have a letter with values that you want to average (e.g. all the A columns). This assumes that the column headers don't change. If you always want n columns then change any null values to zero before unpivoting, otherwise the null values will not unpivot and you'll get n-x values. Let's say you call the resulting column "Category".
If the Categories you want always start with the letter of interest then write a measure to average across the team where LEFT(MySourceTable[Category], 1) = "A"
 
Upvote 0

Forum statistics

Threads
1,224,034
Messages
6,176,000
Members
452,695
Latest member
Alhassan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top