# Average of Group, not per item



## zapppsr (Nov 4, 2015)

Hi. 

I have some data that is organized like this:

Group 1 - Jan - Type 1 = 100
Group 1 - Feb - Type 1 = 100
Group 1 - Jan - Type 2 = 10
Group 1 - Feb Type 2 = 10

The Average of *Type 1, is 100*. The Average of *Type 2, is 10*. The Average of all, regardless type, is *55*.

Now, if I sum the data by group, I will have 110 in Jan and 110 in Feb, which gives me the Average of *110 for the sum of the group*.

I have this measure in Power Bi: MetaM = AVERAGE('Produção Fisica'[Total Meta]). This results in 55, because it is calculating the average of the items in Group 1.

[Total Meta] is calculated on the type level.

I want a measure that gives me 110, which is the average of the sum of the items in the group.

Can it be done?


----------



## scottsen (Nov 4, 2015)

> average of the sum of the items in the group.



Maybe this?  Didn't totally get the ask here... 
=AVERAGEX(VALUES(MyTable[GroupField]), CALCULATE(SUM(MyTable[ValueField])))


----------



## zapppsr (Nov 5, 2015)

Thank you very much for answering scottsen . I gave it a try right now, but instead of getting the average of the group, I'm getting the sum. Probably because the last part of the expression.
You said you did't understand well what I was asking... let me put this way:

The data is:

Group 1 - Jan - Type 1 = 100
Group 1 - Feb - Type 1 = 100
Group 1 - Jan - Type 2 = 10
Group 1 - Feb Type 2 = 10

But I want to calculate as if it was like this:

Group 1 - Jan - = 100
Group 1 - Jan - = 10
Group 1 - Feb - = 10
Group 1 - Feb - = 100

Jan 110, Feb 110, Average = 110

Its like ignoring the type and sum by the group.

Looking at your solution I though it would work, but the averagex encapsulating the rest is not making an average but a sum.

I hope I was able to explain better now.


----------



## scottsen (Nov 6, 2015)

Ya, I still like my measure.  SUM some stuff together, than Average them.

What does your measure actually look like?
=AVERAGEX(VALUES(MyTable[*Months*]), CALCULATE(SUM(MyTable[ValueField])))


----------

