Forum Discussion
Shrujan1612
1 year agoHelper I
Average headcount (current + previous month)/2
I want to calculate (current + previous month)/2 Below is the measure i am using for average calculation. Average Current and Previous Month Headcount = VAR SelectedDate = MAX('Presentation Calend...
- 1 year ago
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Count avg: = SUMX ( SUMMARIZE ( 'Calendar', 'Calendar'[Month-Year sort], 'Calendar'[Month-Year] ), CALCULATE ( VAR _currentmonth = SUM ( data[count] ) VAR _prevmonth = CALCULATE ( SUM ( data[count] ), OFFSET ( -1, ALL ( 'Calendar'[Month-Year], 'Calendar'[Month-Year sort] ), ORDERBY ( 'Calendar'[Month-Year sort], ASC ) ) ) RETURN IF ( _currentmonth && _prevmonth, DIVIDE ( _currentmonth + _prevmonth, 2 ) ) ) )
Jihwan_Kim
1 year agoSuper User
Hi,
I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Count avg: =
SUMX (
SUMMARIZE ( 'Calendar', 'Calendar'[Month-Year sort], 'Calendar'[Month-Year] ),
CALCULATE (
VAR _currentmonth =
SUM ( data[count] )
VAR _prevmonth =
CALCULATE (
SUM ( data[count] ),
OFFSET (
-1,
ALL ( 'Calendar'[Month-Year], 'Calendar'[Month-Year sort] ),
ORDERBY ( 'Calendar'[Month-Year sort], ASC )
)
)
RETURN
IF ( _currentmonth && _prevmonth, DIVIDE ( _currentmonth + _prevmonth, 2 ) )
)
)