Forum Discussion
twister8889
6 years agoHelper V
Moving average by month / moving variance
Hi guys, I need to calculate the average considering that: The previous months of 12, has average by the quantity of month. So if I have 6 months, the average is replicated to the previous months...
- 6 years ago
twister8889
Use this measure :New Avg = VAR IND = SELECTEDVALUE('Table'[Index]) VAR _12 = CALCULATE( AVERAGE('Table'[Value]), 'Table'[Index] <= 12, ALLSELECTED('Table') ) VAR _OVER12 = CALCULATE( AVERAGE('Table'[Value]), 'Table'[Index] <= IND && 'Table'[Index] > IND - 12 ,ALLSELECTED('Table') ) RETURN IF( IND > 12, _OVER12, _12 )________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
Fowmy
6 years agoSuper User
twister8889
Use this measure :
New Avg =
VAR IND = SELECTEDVALUE('Table'[Index])
VAR _12 =
CALCULATE(
AVERAGE('Table'[Value]),
'Table'[Index] <= 12,
ALLSELECTED('Table')
)
VAR _OVER12 =
CALCULATE(
AVERAGE('Table'[Value]),
'Table'[Index] <= IND && 'Table'[Index] > IND - 12
,ALLSELECTED('Table')
)
RETURN
IF( IND > 12,
_OVER12,
_12
)
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
Click on the Thumbs-Up icon on the right if you like this reply 🙂
twister8889
6 years agoHelper V
I will test, but I think that it is the correct solution, thank you so much.
Let me try to test this solution until Monday to check as a solution ok? More one time, thank you so much.