Forum Discussion
Anonymous
8 years agoNot applicable
Calculate Average based on latest month
Each month, I get an updated forecast for oil production (4.PE - FC17) which includes historical data + forecasted data by month. So for example, May's report will have actual production from Jan - A...
- 8 years ago
you can use VAR in your measure
Yr PE Curr Mo =
VAR MaxDate = MAX(InputData[PE FC MoYr]) RETURN
CALCULATE('Input Data'[4. PE - FC17], 'Input Data'[PE FC MoYr] = DATE(2017 , MONTH(MaxDate) - 1 , 1)) - 8 years ago
Hi Anonymous,
Please try:
7. Yr PE Curr Mo =
CALCULATE (
'Input Data'[4. PE - FC17],
FILTER (
'Input Data',
'Input Data'[PE FC MoYr] = LASTDATE ( 'Input Data'[PE FC MoYr] )
)
)Regards,
Yuliana Gu
Anonymous
8 years agoNot applicable
Wow thanks this worked. Not sure I understand the syntax though...
Does VAR allow you to define a local variable that only works within that measure? Or can I use MaxDate in other measures as well?
Thanks for the help!
vik0810
Resolver V
8 years agoHi Anonymous, glad it worked out. The variables defined with VAR can be used in current measure only.