Forum Discussion
DAX Help : Previous 3 Months average
- 4 years ago
Anonymous
Average of Previous 3 Full Months = VAR _current_date = 'Table'[GRN Date] VAR _end_point = EOMONTH(_current_date, -1) VAR _start_point = EOMONTH(_current_date, -4) + 1 VAR _min_date_total = MIN('Table'[GRN Date]) VAR _result = DIVIDE( SUMX( FILTER( 'Table', 'Table'[GRN Date] >= _start_point && 'Table'[GRN Date] <= _end_point ), 'Table'[Lead Time (Days)] ), 3 ) RETURN IF( EOMONTH(_start_point, -1) >= EOMONTH(_min_date_total, -1), _result ) - 4 years ago
Anonymous we are not dealing here with best practice stuff, but, as we created the column before you can create this measure to use as the line value:
Average of Previous 3 Full Months Measure Dependant on Coloumn =AVERAGE('Table '[Average of Previous 3 Full Months Calculated Column])
Anonymous in your photo is that a data table and you need a calculated column or that is a visual table and you want to add a measure? If it's a visual what is the measure you have there for Lead Time (Days)?
- Anonymous4 years agoNot applicable
is actually a table that need to calculated a column ya.
- SpartaBI4 years ago
Community Champion
Anonymous
Average of Previous 3 Full Months = VAR _current_date = 'Table'[GRN Date] VAR _end_point = EOMONTH(_current_date, -1) VAR _start_point = EOMONTH(_current_date, -4) + 1 VAR _min_date_total = MIN('Table'[GRN Date]) VAR _result = DIVIDE( SUMX( FILTER( 'Table', 'Table'[GRN Date] >= _start_point && 'Table'[GRN Date] <= _end_point ), 'Table'[Lead Time (Days)] ), 3 ) RETURN IF( EOMONTH(_start_point, -1) >= EOMONTH(_min_date_total, -1), _result )- Anonymous4 years agoNot applicable
Hi SpartaBI , sincerrely apologise to interrupt you again.
I have face another difficulties that is similar to this question. However, in the current case, I would like to created visual table and add a measure. For example, based on the visual below, the light blue color bar can be refer to the average of the lead times (which i can just drag the column into the visual and click calculate average); the main problem that I face, is that how am i able to show the average lead time of the previous 3 month in the line value, for instance, the line chart of april should show 19 ,may is 22 , june is 15. Thanks you so much for your assistance