Forum Discussion
Moving average
- 3 years ago
Hi , Kleine285
I download this .pbix file , the filed in the visual is wrong, youo need to use the [Maand] filed in the 'Measures Mndst' table and [14.0] measure you created before not in the 'Table2'.
For your need , you should update the measure to this :
Moving average = var _date =SELECTEDVALUE('Mndst'[Maand]) var _this_year_month =MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date) ,MONTH(_date),1)) , [14.0]) var _last_year_dec = MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date) -1 ,12,1)) , [14.0]) return IF(_last_year_dec=BLANK(),BLANK(),DIVIDE(_last_year_dec+_this_year_month,2))The result is follows , i think that is your need :
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , Kleine285
I download this .pbix file , the filed in the visual is wrong, youo need to use the [Maand] filed in the 'Measures Mndst' table and [14.0] measure you created before not in the 'Table2'.
For your need , you should update the measure to this :
Moving average = var _date =SELECTEDVALUE('Mndst'[Maand])
var _this_year_month =MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date) ,MONTH(_date),1)) , [14.0])
var _last_year_dec = MAXX( FILTER( 'Table 2' , [Maand] = DATE( YEAR( _date) -1 ,12,1)) , [14.0])
return
IF(_last_year_dec=BLANK(),BLANK(),DIVIDE(_last_year_dec+_this_year_month,2))
The result is follows , i think that is your need :
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you all, especially Aniya Zhang for your help.