Reputation: 1
I would like to calculate the average of a measure (ETP). I use this formula.
Moyenne :=
SUMX (
Personne;
AVERAGEX (
Lien_Contrat_SA_BP;
CALCULATE (
'Lien_Contrat_SA_BP'[ETP_Contractuel1];
ALLEXCEPT ( 'Temps'; Temps[Date] )
)
)
)
For the same month, I have two values.
For example :
January 1
February 1
March 1
March 0.8
I would like to do this calculation
(1 + 1 + 0.9) / 3
and not (1 + 1 + 1 + 0.8)/4
How can I do this? Thank you for your answer.
Upvotes: 0
Views: 834
Reputation: 1
I have tested this measure : SUMX ( Personne; CALCULATE ( AVERAGEX ( Temps; CALCULATE ( [ETP_Contractuel1]; ALL ( 'Temps' ); VALUES ( ‘Temps'[Mois] ) ) ) ) )
this is average for each month, but I do not get the overall average every month because it counts twice the month of August.
Upvotes: 0
Reputation: 2968
With the first column in your example called [Month] and the second column called [Value], this measure should give the avg you are looking for:
Measure =
AVERAGEX (
SUMMARIZE ( Table1, Table1[Month], "avg", AVERAGE ( Table1[Value] ) ),
[avg]
)
It works like this:
The SUMMARIZE-function creates a virtual summarized table, calculating the average for each month. Like this:
Month avg
January 1
Febuary 1
March 0.9
The AVERAGEX function then returns the average of the values in the resulting [avg] column.
Upvotes: 1